@faskai/ui-commons 0.0.0-alpha.24 → 0.0.0-alpha.26
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/dist/components/connections/app-icon.js +14 -17
- package/dist/components/connections/app-search-grid.js +13 -14
- package/dist/components/connections/available-apps-list.js +10 -7
- package/dist/components/connections/connected-apps-list.js +13 -14
- package/dist/components/connections/connections-api-provider.js +7 -11
- package/dist/components/connections/connections-panel.d.ts +1 -3
- package/dist/components/connections/connections-panel.js +48 -82
- package/dist/components/gtm/gtm-provider.js +5 -11
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +22 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +31 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.js +24 -0
- package/dist/data/betaMarketingData.js +1 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -22
- package/dist/lib/utils.js +4 -7
- package/dist/types/connections-api.d.ts +3 -3
- package/dist/types/connections-api.js +1 -2
- package/dist/types/connections.js +1 -2
- package/package.json +7 -1
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const lucide_react_1 = require("lucide-react");
|
|
7
|
-
const utils_1 = require("../../lib/utils");
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Blocks, Landmark, Building2, CreditCard, ShoppingCart, Calendar, Mail, MessageSquare, } from 'lucide-react';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
8
5
|
const iconMap = {
|
|
9
|
-
landmark:
|
|
10
|
-
building2:
|
|
11
|
-
'credit-card':
|
|
12
|
-
'shopping-cart':
|
|
13
|
-
calendar:
|
|
14
|
-
mail:
|
|
15
|
-
'message-square':
|
|
6
|
+
landmark: Landmark,
|
|
7
|
+
building2: Building2,
|
|
8
|
+
'credit-card': CreditCard,
|
|
9
|
+
'shopping-cart': ShoppingCart,
|
|
10
|
+
calendar: Calendar,
|
|
11
|
+
mail: Mail,
|
|
12
|
+
'message-square': MessageSquare,
|
|
16
13
|
};
|
|
17
|
-
const FallbackIcon =
|
|
18
|
-
function AppIcon({ src, icon, alt, className }) {
|
|
14
|
+
const FallbackIcon = Blocks;
|
|
15
|
+
export function AppIcon({ src, icon, alt, className }) {
|
|
19
16
|
if (src) {
|
|
20
|
-
return (
|
|
17
|
+
return _jsx("img", { src: src, alt: alt, className: cn('rounded', className) });
|
|
21
18
|
}
|
|
22
19
|
const Icon = (icon && iconMap[icon]) || FallbackIcon;
|
|
23
|
-
return (
|
|
20
|
+
return _jsx(Icon, { className: cn('text-muted-foreground', className) });
|
|
24
21
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function AppSearchGrid({ connectedAppKeys, onSearch, onConnect, connecting, initialApps, }) {
|
|
10
|
-
const [query, setQuery] =
|
|
11
|
-
const [apps, setApps] =
|
|
12
|
-
const [searching, setSearching] =
|
|
13
|
-
const debounceRef =
|
|
14
|
-
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Loader2 } from 'lucide-react';
|
|
5
|
+
import { AppIcon } from './app-icon';
|
|
6
|
+
import { Badge } from '../ui/badge';
|
|
7
|
+
import { Button } from '../ui/button';
|
|
8
|
+
export function AppSearchGrid({ connectedAppKeys, onSearch, onConnect, connecting, initialApps, }) {
|
|
9
|
+
const [query, setQuery] = useState('');
|
|
10
|
+
const [apps, setApps] = useState(initialApps || []);
|
|
11
|
+
const [searching, setSearching] = useState(false);
|
|
12
|
+
const debounceRef = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
15
14
|
if (debounceRef.current)
|
|
16
15
|
clearTimeout(debounceRef.current);
|
|
17
16
|
debounceRef.current = setTimeout(async () => {
|
|
@@ -32,5 +31,5 @@ function AppSearchGrid({ connectedAppKeys, onSearch, onConnect, connecting, init
|
|
|
32
31
|
function isConnected(slug) {
|
|
33
32
|
return connectedAppKeys.includes(slug);
|
|
34
33
|
}
|
|
35
|
-
return ((
|
|
34
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium", children: "Connect Apps" }), _jsx("p", { className: "text-muted-foreground text-xs", children: "Search and connect apps for your agent." })] }), _jsx("input", { className: "border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 w-full rounded-md border px-3 py-1 text-sm shadow-sm transition-colors focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", placeholder: "Search apps (e.g. Slack, Google Sheets, HubSpot)...", value: query, onChange: (e) => setQuery(e.target.value) }), searching && (_jsxs("div", { className: "flex items-center gap-2 py-4", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), _jsx("span", { className: "text-muted-foreground text-sm", children: "Searching..." })] })), apps.length > 0 && (_jsx("div", { className: "grid gap-2 sm:grid-cols-2 lg:grid-cols-3", children: apps.map((app) => (_jsxs("div", { className: "flex items-center gap-3 rounded-lg border p-3", children: [_jsx(AppIcon, { src: app.img_src, alt: app.name, className: "size-8" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm font-medium", children: app.name }), isConnected(app.name_slug) && (_jsx("span", { className: "text-muted-foreground text-xs", children: "Connected" }))] }), isConnected(app.name_slug) ? (_jsx(Badge, { children: "Connected" })) : (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => onConnect(app), disabled: connecting === app.name_slug, children: [connecting === app.name_slug && (_jsx(Loader2, { className: "animate-spin" })), "Connect"] }))] }, app.name_slug))) }))] }));
|
|
36
35
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Link, Loader2 } from 'lucide-react';
|
|
4
|
+
import { AppIcon } from './app-icon';
|
|
5
|
+
import { Card, CardHeader, CardFooter } from '../ui/card';
|
|
6
|
+
import { Button } from '../ui/button';
|
|
7
|
+
export function AvailableAppsList({ connections, onConnect, connecting, }) {
|
|
8
8
|
const available = connections.filter((c) => c.status !== 'connected');
|
|
9
9
|
if (available.length === 0)
|
|
10
10
|
return null;
|
|
11
|
-
return ((
|
|
11
|
+
return (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: available.map((conn) => {
|
|
12
|
+
const isConnecting = connecting === conn.appKey;
|
|
13
|
+
return (_jsxs(Card, { className: "gap-4 py-4", children: [_jsxs(CardHeader, { className: "flex-row items-center gap-3", children: [_jsx("div", { className: "bg-background flex size-12 shrink-0 items-center justify-center rounded-lg border p-2", children: _jsx(AppIcon, { src: conn.app?.img, icon: conn.app?.icon, alt: conn.app?.name, className: "size-full object-contain" }) }), _jsx("p", { className: "min-w-0 flex-1 truncate text-base font-semibold", children: conn.app?.name })] }), _jsx(CardFooter, { children: _jsxs(Button, { className: "w-full", onClick: () => onConnect(conn), disabled: isConnecting, children: [isConnecting ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(Link, {})), isConnecting ? 'Connecting...' : 'Connect'] }) })] }, conn.id || conn.appKey));
|
|
14
|
+
}) }));
|
|
12
15
|
}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Loader2, RefreshCw, Unlink } from 'lucide-react';
|
|
4
|
+
import { AppIcon } from './app-icon';
|
|
5
|
+
import { Card, CardHeader, CardFooter, CardAction } from '../ui/card';
|
|
6
|
+
import { Badge } from '../ui/badge';
|
|
7
|
+
import { Button } from '../ui/button';
|
|
8
|
+
export function ConnectedAppsList({ connections, variant, onReimport, onDisconnect, reimporting, disconnecting, }) {
|
|
9
9
|
const connected = connections.filter((c) => c.status === 'connected');
|
|
10
10
|
if (connected.length === 0)
|
|
11
11
|
return null;
|
|
12
12
|
if (variant === 'badges') {
|
|
13
|
-
return ((
|
|
13
|
+
return (_jsx("div", { className: "flex flex-wrap gap-2", children: connected.map((conn) => (_jsxs(Badge, { children: [_jsx(AppIcon, { src: conn.app?.img, icon: conn.app?.icon, alt: conn.app?.name, className: "size-4" }), conn.app?.name] }, conn.appKey))) }));
|
|
14
14
|
}
|
|
15
15
|
// cards variant
|
|
16
|
-
return ((
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: 'Disconnect'] }))] })] }, conn.id || conn.appKey))) }));
|
|
16
|
+
return (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: connected.map((conn) => {
|
|
17
|
+
const isReimporting = reimporting === (conn.providerConnectionId || conn.appKey);
|
|
18
|
+
const isDisconnecting = disconnecting === (conn.id || conn.appKey);
|
|
19
|
+
return (_jsxs(Card, { className: "gap-4 py-4", children: [_jsxs(CardHeader, { className: "flex-row items-center gap-3", children: [_jsx("div", { className: "bg-background flex size-12 shrink-0 items-center justify-center rounded-lg border p-2", children: _jsx(AppIcon, { src: conn.app?.img, icon: conn.app?.icon, alt: conn.app?.name, className: "size-full object-contain" }) }), _jsx("p", { className: "min-w-0 flex-1 truncate text-base font-semibold", children: conn.app?.name }), _jsx(CardAction, { children: _jsxs(Badge, { variant: "outline", children: [_jsx(Check, { className: "size-3" }), "Connected"] }) })] }), _jsxs(CardFooter, { className: "gap-2", children: [onReimport && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => onReimport(conn), disabled: isReimporting, children: [isReimporting ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(RefreshCw, {})), isReimporting ? 'Reimporting...' : 'Reimport'] })), onDisconnect && (_jsxs(Button, { variant: "outline", size: "sm", className: "text-destructive hover:text-destructive", onClick: () => onDisconnect(conn), disabled: isDisconnecting, children: [isDisconnecting ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(Unlink, {})), isDisconnecting ? 'Disconnecting...' : 'Disconnect'] }))] })] }, conn.id || conn.appKey));
|
|
20
|
+
}) }));
|
|
22
21
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const ConnectionsApiContext = (0, react_1.createContext)(null);
|
|
9
|
-
function useConnectionsApi() {
|
|
10
|
-
const api = (0, react_1.useContext)(ConnectionsApiContext);
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
const ConnectionsApiContext = createContext(null);
|
|
5
|
+
export function useConnectionsApi() {
|
|
6
|
+
const api = useContext(ConnectionsApiContext);
|
|
11
7
|
if (!api) {
|
|
12
8
|
throw new Error('useConnectionsApi must be used within a ConnectionsApiProvider');
|
|
13
9
|
}
|
|
14
10
|
return api;
|
|
15
11
|
}
|
|
16
|
-
function ConnectionsApiProvider({ api, children, }) {
|
|
17
|
-
return ((
|
|
12
|
+
export function ConnectionsApiProvider({ api, children, }) {
|
|
13
|
+
return (_jsx(ConnectionsApiContext.Provider, { value: api, children: children }));
|
|
18
14
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { FaskConnection } from '../../types/connections';
|
|
2
2
|
interface ConnectionsPanelProps {
|
|
3
3
|
variant: 'full-page' | 'compact';
|
|
4
|
-
showSearch?: boolean;
|
|
5
|
-
showReimport?: boolean;
|
|
6
4
|
onConnectionsLoaded?: (connections: FaskConnection[]) => void;
|
|
7
5
|
}
|
|
8
|
-
export declare function ConnectionsPanel({ variant,
|
|
6
|
+
export declare function ConnectionsPanel({ variant, onConnectionsLoaded, }: ConnectionsPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
7
|
export {};
|
|
@@ -1,46 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function ConnectionsPanel({ variant,
|
|
12
|
-
const api =
|
|
13
|
-
const [connections, setConnections] =
|
|
14
|
-
const [
|
|
15
|
-
const [
|
|
16
|
-
const [
|
|
17
|
-
const [disconnecting, setDisconnecting] =
|
|
18
|
-
const
|
|
19
|
-
const pollIntervalRef = (0, react_1.useRef)(null);
|
|
20
|
-
const loadData = (0, react_1.useCallback)(async () => {
|
|
21
|
-
setLoading(true);
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { createFrontendClient } from '@pipedream/sdk/browser';
|
|
5
|
+
import { useConnectionsApi } from './connections-api-provider';
|
|
6
|
+
import { ConnectedAppsList } from './connected-apps-list';
|
|
7
|
+
import { AvailableAppsList } from './available-apps-list';
|
|
8
|
+
import { AppSearchGrid } from './app-search-grid';
|
|
9
|
+
import { Card } from '../ui/card';
|
|
10
|
+
export function ConnectionsPanel({ variant, onConnectionsLoaded, }) {
|
|
11
|
+
const api = useConnectionsApi();
|
|
12
|
+
const [connections, setConnections] = useState([]);
|
|
13
|
+
const [initialApps, setInitialApps] = useState([]);
|
|
14
|
+
const [loading, setLoading] = useState(true);
|
|
15
|
+
const [connecting, setConnecting] = useState(null);
|
|
16
|
+
const [disconnecting, setDisconnecting] = useState(null);
|
|
17
|
+
const loadData = useCallback(async () => {
|
|
22
18
|
const conns = await api.getConnections();
|
|
23
|
-
// Salesforce polling detection
|
|
24
|
-
const wasConnected = prevConnectionsRef.current.some((c) => c.appKey === 'salesforce' && c.status === 'connected');
|
|
25
|
-
const isConnected = conns.some((c) => c.appKey === 'salesforce' && c.status === 'connected');
|
|
26
|
-
if (prevConnectionsRef.current.length > 0 &&
|
|
27
|
-
!wasConnected &&
|
|
28
|
-
isConnected) {
|
|
29
|
-
if (pollIntervalRef.current)
|
|
30
|
-
clearInterval(pollIntervalRef.current);
|
|
31
|
-
}
|
|
32
|
-
prevConnectionsRef.current = conns;
|
|
33
19
|
setConnections(conns);
|
|
34
20
|
onConnectionsLoaded?.(conns);
|
|
35
|
-
setLoading(false);
|
|
36
21
|
}, [api, onConnectionsLoaded]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
async function init() {
|
|
24
|
+
setLoading(true);
|
|
25
|
+
const [, apps] = await Promise.all([
|
|
26
|
+
loadData(),
|
|
27
|
+
api.searchApps(''),
|
|
28
|
+
]);
|
|
29
|
+
setInitialApps(apps);
|
|
30
|
+
setLoading(false);
|
|
31
|
+
}
|
|
32
|
+
init();
|
|
33
|
+
}, [loadData, api]);
|
|
44
34
|
const connectedAppKeys = connections
|
|
45
35
|
.filter((c) => c.status === 'connected')
|
|
46
36
|
.map((c) => c.appKey);
|
|
@@ -48,34 +38,28 @@ function ConnectionsPanel({ variant, showSearch, showReimport, onConnectionsLoad
|
|
|
48
38
|
const appKey = 'appKey' in app ? app.appKey : app.name_slug;
|
|
49
39
|
setConnecting(appKey);
|
|
50
40
|
try {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
41
|
+
const { token, expiresAt } = await api.getConnectToken(appKey);
|
|
42
|
+
const pd = createFrontendClient({
|
|
43
|
+
externalUserId: 'user',
|
|
44
|
+
tokenCallback: async () => ({
|
|
45
|
+
token,
|
|
46
|
+
expiresAt: new Date(expiresAt),
|
|
47
|
+
connectLinkUrl: '',
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
await new Promise((resolve, reject) => {
|
|
51
|
+
pd.connectAccount({
|
|
52
|
+
app: appKey,
|
|
53
|
+
onSuccess: () => resolve(),
|
|
54
|
+
onError: (err) => reject(err),
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
await loadData();
|
|
64
58
|
}
|
|
65
59
|
finally {
|
|
66
60
|
setConnecting(null);
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
|
-
async function handleReimport(conn) {
|
|
70
|
-
const key = conn.providerConnectionId || conn.appKey;
|
|
71
|
-
setReimporting(key);
|
|
72
|
-
try {
|
|
73
|
-
await api.reimport?.(conn.providerConnectionId, conn.appKey);
|
|
74
|
-
}
|
|
75
|
-
finally {
|
|
76
|
-
setReimporting(null);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
63
|
async function handleDisconnect(conn) {
|
|
80
64
|
const key = conn.id || conn.appKey;
|
|
81
65
|
setDisconnecting(key);
|
|
@@ -87,29 +71,11 @@ function ConnectionsPanel({ variant, showSearch, showReimport, onConnectionsLoad
|
|
|
87
71
|
setDisconnecting(null);
|
|
88
72
|
}
|
|
89
73
|
}
|
|
90
|
-
async function handleSearchConnect(app) {
|
|
91
|
-
await handleConnect(app);
|
|
92
|
-
}
|
|
93
74
|
if (loading) {
|
|
94
|
-
return ((
|
|
75
|
+
return (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: [1, 2, 3].map((i) => (_jsx(Card, { className: "h-28 animate-pulse bg-muted/50" }, i))) }));
|
|
95
76
|
}
|
|
96
77
|
if (variant === 'compact') {
|
|
97
|
-
|
|
98
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [(connectedAppKeys.length > 0 ||
|
|
99
|
-
availableAppsWithActions.length > 0) && ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-3", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-sm font-medium", children: "Connected Apps" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-2", children: [connections
|
|
100
|
-
.filter((c) => c.status === 'connected')
|
|
101
|
-
.map((conn) => ((0, jsx_runtime_1.jsxs)("span", { className: "bg-primary text-primary-foreground inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium", children: [(0, jsx_runtime_1.jsx)(AppIconInline, { src: conn.app?.img, icon: conn.app?.icon, alt: conn.app?.name }), conn.app?.name] }, conn.appKey))), availableAppsWithActions.map((conn) => ((0, jsx_runtime_1.jsxs)("span", { className: "bg-secondary text-secondary-foreground inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium opacity-60", children: [(0, jsx_runtime_1.jsx)(AppIconInline, { src: conn.app?.img, icon: conn.app?.icon, alt: conn.app?.name }), conn.app?.name, (0, jsx_runtime_1.jsx)("span", { className: "text-[10px]", children: "Not connected" })] }, conn.appKey)))] })] })), showSearch && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("hr", { className: "border-border" }), (0, jsx_runtime_1.jsx)(app_search_grid_1.AppSearchGrid, { connectedAppKeys: connectedAppKeys, onSearch: (q) => api.searchApps(q), onConnect: handleSearchConnect, connecting: connecting })] }))] }));
|
|
102
|
-
}
|
|
103
|
-
// full-page variant
|
|
104
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "space-y-6", children: [(0, jsx_runtime_1.jsx)(connected_apps_list_1.ConnectedAppsList, { connections: connections, variant: "cards", onReimport: showReimport ? handleReimport : undefined, onDisconnect: handleDisconnect, reimporting: reimporting, disconnecting: disconnecting }), (0, jsx_runtime_1.jsx)(available_apps_list_1.AvailableAppsList, { connections: connections, onConnect: handleConnect, connecting: connecting }), showSearch && ((0, jsx_runtime_1.jsx)(app_search_grid_1.AppSearchGrid, { connectedAppKeys: connectedAppKeys, onSearch: (q) => api.searchApps(q), onConnect: handleSearchConnect, connecting: connecting }))] }));
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Tiny inline icon for badge usage (avoids importing the full AppIcon component tree).
|
|
108
|
-
*/
|
|
109
|
-
function AppIconInline({ src, icon, alt, }) {
|
|
110
|
-
if (src) {
|
|
111
|
-
return (0, jsx_runtime_1.jsx)("img", { src: src, alt: alt, className: "size-4 rounded" });
|
|
78
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsx(ConnectedAppsList, { connections: connections, variant: "badges", onDisconnect: handleDisconnect, disconnecting: disconnecting }), _jsx(AppSearchGrid, { connectedAppKeys: connectedAppKeys, onSearch: (q) => api.searchApps(q), onConnect: (app) => handleConnect(app), connecting: connecting, initialApps: initialApps })] }));
|
|
112
79
|
}
|
|
113
|
-
|
|
114
|
-
return ((0, jsx_runtime_1.jsx)("span", { className: "bg-muted-foreground/20 inline-block size-4 rounded" }));
|
|
80
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsx(ConnectedAppsList, { connections: connections, variant: "cards", onDisconnect: handleDisconnect, disconnecting: disconnecting }), _jsx(AvailableAppsList, { connections: connections, onConnect: handleConnect, connecting: connecting }), _jsx(AppSearchGrid, { connectedAppKeys: connectedAppKeys, onSearch: (q) => api.searchApps(q), onConnect: (app) => handleConnect(app), connecting: connecting, initialApps: initialApps })] }));
|
|
115
81
|
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GTMProvider = GTMProvider;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const script_1 = __importDefault(require("next/script"));
|
|
9
|
-
function GTMProvider({ gtmId, children }) {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(script_1.default, { id: "gtm-head", strategy: "afterInteractive", children: `
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Script from 'next/script';
|
|
3
|
+
export function GTMProvider({ gtmId, children }) {
|
|
4
|
+
return (_jsxs(_Fragment, { children: [_jsx(Script, { id: "gtm-head", strategy: "afterInteractive", children: `
|
|
11
5
|
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
12
6
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
13
7
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
14
8
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
15
9
|
})(window,document,'script','dataLayer','${gtmId}');
|
|
16
|
-
` }), (
|
|
10
|
+
` }), _jsx("noscript", { children: _jsx("iframe", { src: `https://www.googletagmanager.com/ns.html?id=${gtmId}`, height: "0", width: "0", style: { display: 'none', visibility: 'hidden' } }) }), children] }));
|
|
17
11
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
const badgeVariants = cva('inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden', {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
|
9
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
|
|
10
|
+
destructive: 'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
11
|
+
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: 'default',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
function Badge({ className, variant, asChild = false, ...props }) {
|
|
19
|
+
const Comp = asChild ? Slot : 'span';
|
|
20
|
+
return (_jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
5
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
9
|
+
destructive: 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
10
|
+
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
11
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
12
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
13
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
17
|
+
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
18
|
+
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
19
|
+
icon: 'size-9',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
size: 'default',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
function Button({ className, variant, size, asChild = false, ...props }) {
|
|
28
|
+
const Comp = asChild ? Slot : 'button';
|
|
29
|
+
return (_jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
|
|
30
|
+
}
|
|
31
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
function Card({ className, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "card", className: cn('bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm', className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
function CardHeader({ className, ...props }) {
|
|
7
|
+
return (_jsx("div", { "data-slot": "card-header", className: cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function CardTitle({ className, ...props }) {
|
|
10
|
+
return (_jsx("div", { "data-slot": "card-title", className: cn('leading-none font-semibold', className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function CardDescription({ className, ...props }) {
|
|
13
|
+
return (_jsx("div", { "data-slot": "card-description", className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function CardAction({ className, ...props }) {
|
|
16
|
+
return (_jsx("div", { "data-slot": "card-action", className: cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function CardContent({ className, ...props }) {
|
|
19
|
+
return (_jsx("div", { "data-slot": "card-content", className: cn('px-6', className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function CardFooter({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "card-footer", className: cn('flex items-center px-6 [.border-t]:pt-6', className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.betaOfferData = void 0;
|
|
4
|
-
exports.betaOfferData = {
|
|
1
|
+
export const betaOfferData = {
|
|
5
2
|
badge: 'LIMITED TIME',
|
|
6
3
|
title: 'Beta Launch Special',
|
|
7
4
|
description: 'Join our exclusive Beta program and get direct access to our founders.',
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,7 @@ export { AppSearchGrid } from './components/connections/app-search-grid';
|
|
|
8
8
|
export { ConnectionsPanel } from './components/connections/connections-panel';
|
|
9
9
|
export type { FaskConnection, FaskSearchableApp } from './types/connections';
|
|
10
10
|
export type { ConnectionsApi } from './types/connections-api';
|
|
11
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, } from './components/ui/card';
|
|
12
|
+
export { Badge, badgeVariants } from './components/ui/badge';
|
|
13
|
+
export { Button, buttonVariants } from './components/ui/button';
|
|
11
14
|
export { cn } from './lib/utils';
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.cn = exports.ConnectionsPanel = exports.AppSearchGrid = exports.AvailableAppsList = exports.ConnectedAppsList = exports.AppIcon = exports.useConnectionsApi = exports.ConnectionsApiProvider = exports.betaOfferData = exports.GTMProvider = void 0;
|
|
4
|
-
var gtm_provider_1 = require("./components/gtm/gtm-provider");
|
|
5
|
-
Object.defineProperty(exports, "GTMProvider", { enumerable: true, get: function () { return gtm_provider_1.GTMProvider; } });
|
|
6
|
-
var betaMarketingData_1 = require("./data/betaMarketingData");
|
|
7
|
-
Object.defineProperty(exports, "betaOfferData", { enumerable: true, get: function () { return betaMarketingData_1.betaOfferData; } });
|
|
1
|
+
export { GTMProvider } from './components/gtm/gtm-provider';
|
|
2
|
+
export { betaOfferData } from './data/betaMarketingData';
|
|
8
3
|
// Connections
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(exports, "AppSearchGrid", { enumerable: true, get: function () { return app_search_grid_1.AppSearchGrid; } });
|
|
20
|
-
var connections_panel_1 = require("./components/connections/connections-panel");
|
|
21
|
-
Object.defineProperty(exports, "ConnectionsPanel", { enumerable: true, get: function () { return connections_panel_1.ConnectionsPanel; } });
|
|
4
|
+
export { ConnectionsApiProvider, useConnectionsApi, } from './components/connections/connections-api-provider';
|
|
5
|
+
export { AppIcon } from './components/connections/app-icon';
|
|
6
|
+
export { ConnectedAppsList } from './components/connections/connected-apps-list';
|
|
7
|
+
export { AvailableAppsList } from './components/connections/available-apps-list';
|
|
8
|
+
export { AppSearchGrid } from './components/connections/app-search-grid';
|
|
9
|
+
export { ConnectionsPanel } from './components/connections/connections-panel';
|
|
10
|
+
// UI primitives (shadcn)
|
|
11
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, } from './components/ui/card';
|
|
12
|
+
export { Badge, badgeVariants } from './components/ui/badge';
|
|
13
|
+
export { Button, buttonVariants } from './components/ui/button';
|
|
22
14
|
// Utilities
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(exports, "cn", { enumerable: true, get: function () { return utils_1.cn; } });
|
|
15
|
+
export { cn } from './lib/utils';
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const tailwind_merge_1 = require("tailwind-merge");
|
|
6
|
-
function cn(...inputs) {
|
|
7
|
-
return (0, tailwind_merge_1.twMerge)((0, clsx_1.clsx)(inputs));
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
export function cn(...inputs) {
|
|
4
|
+
return twMerge(clsx(inputs));
|
|
8
5
|
}
|
|
@@ -2,9 +2,9 @@ import type { FaskConnection, FaskSearchableApp } from './connections';
|
|
|
2
2
|
export interface ConnectionsApi {
|
|
3
3
|
getConnections(): Promise<FaskConnection[]>;
|
|
4
4
|
searchApps(query: string): Promise<FaskSearchableApp[]>;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
getConnectToken(appKey: string): Promise<{
|
|
6
|
+
token: string;
|
|
7
|
+
expiresAt: string;
|
|
7
8
|
}>;
|
|
8
9
|
disconnect(connectionId: string): Promise<void>;
|
|
9
|
-
reimport?(connectionId: string, appKey: string): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faskai/ui-commons",
|
|
3
3
|
"author": "Fask AI <arko@fask.ai>",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
4
|
+
"version": "0.0.0-alpha.26",
|
|
5
5
|
"description": "Common UI components for Fask applications.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
"build": "tsc"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
+
"@pipedream/sdk": ">=2.3.0",
|
|
18
|
+
"@radix-ui/react-slot": ">=1.0.0",
|
|
19
|
+
"class-variance-authority": ">=0.7.0",
|
|
17
20
|
"clsx": ">=2.0.0",
|
|
18
21
|
"lucide-react": ">=0.300.0",
|
|
19
22
|
"next": ">=13.0.0",
|
|
@@ -21,7 +24,10 @@
|
|
|
21
24
|
"tailwind-merge": ">=2.0.0"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
27
|
+
"@pipedream/sdk": "^2.3.6",
|
|
28
|
+
"@radix-ui/react-slot": "^1.1.0",
|
|
24
29
|
"@types/react": "^18.0.0",
|
|
30
|
+
"class-variance-authority": "^0.7.0",
|
|
25
31
|
"clsx": "^2.1.0",
|
|
26
32
|
"lucide-react": "^0.400.0",
|
|
27
33
|
"next": "^14.0.0",
|