@burdenoff/microfe-integrations 2026.608.1 → 2026.624.2

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 (43) hide show
  1. package/dist/integrations/IntegrationsAdminRoutes.js +5 -5
  2. package/dist/integrations/IntegrationsAdminRoutes.js.map +1 -1
  3. package/dist/integrations/IntegrationsUserRoutes.js +5 -5
  4. package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
  5. package/dist/integrations/components/AddConnectionDialog.js +313 -284
  6. package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
  7. package/dist/integrations/components/ConfirmDialog.js +5 -5
  8. package/dist/integrations/components/ConfirmDialog.js.map +1 -1
  9. package/dist/integrations/components/ConnectionCard.js +15 -15
  10. package/dist/integrations/components/ConnectionCard.js.map +1 -1
  11. package/dist/integrations/components/CredentialStorageSelector.js +19 -19
  12. package/dist/integrations/components/CredentialStorageSelector.js.map +1 -1
  13. package/dist/integrations/components/ProviderCard.js +16 -15
  14. package/dist/integrations/components/ProviderCard.js.map +1 -1
  15. package/dist/integrations/hooks/useConnections.js +33 -13
  16. package/dist/integrations/hooks/useConnections.js.map +1 -1
  17. package/dist/integrations/pages/AddConnectionWizard.js +143 -113
  18. package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
  19. package/dist/integrations/pages/ConnectionDetail.js +53 -53
  20. package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
  21. package/dist/integrations/pages/ConnectionLogs.js +35 -35
  22. package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
  23. package/dist/integrations/pages/ConnectionsList.js +27 -27
  24. package/dist/integrations/pages/ConnectionsList.js.map +1 -1
  25. package/dist/integrations/pages/IntegrationsOverview.js +33 -33
  26. package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
  27. package/dist/integrations/pages/IntegrationsSettings.js +26 -26
  28. package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
  29. package/dist/integrations/pages/ProviderCatalog.js +30 -29
  30. package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
  31. package/dist/integrations/pages/ProviderDetail.js +46 -46
  32. package/dist/integrations/pages/ProviderDetail.js.map +1 -1
  33. package/dist/integrations/pages/ProviderEditorPage.js +47 -45
  34. package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
  35. package/dist/integrations/utils/appearance.js +7 -7
  36. package/dist/integrations/utils/appearance.js.map +1 -1
  37. package/dist/integrations/utils/constants.js +4 -0
  38. package/dist/integrations/utils/constants.js.map +1 -1
  39. package/dist/integrations/utils/integrationsHelpers.js +1 -0
  40. package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
  41. package/dist/integrations/utils/mappers.js +1 -0
  42. package/dist/integrations/utils/mappers.js.map +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AddConnectionWizard.js","names":[],"sources":["../../../src/integrations/pages/AddConnectionWizard.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, useEffect, useRef } from 'react';\nimport { useParams, useLocation } from 'react-router-dom';\nimport {\n ArrowLeft,\n ArrowRight,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n Key,\n Lock,\n Shield,\n ExternalLink,\n Link,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { joinPath } from '../utils/navigation';\nimport { getAuthTypeLabel, getCategoryLabel } from '../utils/integrationsHelpers';\nimport { useProviders, useProviderByKey, useProvider } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateWithApiKey,\n useAuthenticateWithBasicAuth,\n useAuthenticateWithBearerToken,\n} from '../hooks/useConnections';\nimport { useGetConnectionLazyQuery } from '../../generated/wspace-operations';\nimport { waitForOAuthPopupCompletion } from '../utils/oauthPopup';\nimport {\n CredentialStorageSelector,\n type CredentialStorageState,\n} from '../components/CredentialStorageSelector';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport type { IntegrationProvider } from '../types';\n\ntype WizardStep = 'select_provider' | 'configure' | 'authenticate' | 'success' | 'error';\n\n/**\n * Add Connection Wizard — multi-step wizard for creating new connections.\n *\n * Supports an optional \"botlit channel flow\" activated by URL search params:\n * ?providerKey=slack-user&returnTo=<url>&channelId=<id>\n *\n * In this flow:\n * - The provider is pre-selected by key (not UUID) and the wizard skips directly to configure.\n * - OAuth redirectUri is set to the backend callback so the backend can exchange the token\n * and redirect back to `returnTo?integrationConnectionId=<id>`.\n * - On success, a \"Link to bot channel\" button navigates to returnTo with the connectionId.\n */\nexport function AddConnectionWizard() {\n const { providerId: preselectedProviderId } = useParams<{ providerId: string }>();\n const { basePath = '/', navigate, apiGatewayUrl } = useIntegrations();\n const routerLocation = useLocation();\n const routerSearch = routerLocation.search;\n\n // ── Parse botlit flow query params ──────────────────────────────────────────\n const searchParams = useMemo(() => new URLSearchParams(routerSearch), [routerSearch]);\n const providerKey = searchParams.get('providerKey') ?? null;\n const returnTo = searchParams.get('returnTo') ?? null;\n const channelId = searchParams.get('channelId') ?? null;\n const isBotlitFlow = Boolean(returnTo && channelId);\n\n // If providerKey is present, look up by key; otherwise fall back to preselectedProviderId (UUID)\n const { provider: providerByKey, loading: providerByKeyLoading } = useProviderByKey(\n providerKey ?? ''\n );\n\n const { providers, loading: providersLoading } = useProviders();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateWithApiKey, loading: apiKeyLoading } = useAuthenticateWithApiKey();\n const { authenticateWithBasicAuth, loading: basicAuthLoading } = useAuthenticateWithBasicAuth();\n const { authenticateWithBearerToken, loading: bearerLoading } = useAuthenticateWithBearerToken();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Wizard state\n const initialStep: WizardStep =\n preselectedProviderId || providerKey ? 'configure' : 'select_provider';\n const [step, setStep] = useState<WizardStep>(initialStep);\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Form state\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n const [apiKey, setApiKey] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [bearerToken, setBearerToken] = useState('');\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n\n const [errorMessage, setErrorMessage] = useState('');\n const [createdConnectionId, setCreatedConnectionId] = useState<string | null>(null);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n\n // Cleanup OAuth listener and popup on unmount.\n useEffect(() => {\n return () => {\n oauthCleanupRef.current?.();\n if (oauthPopupRef.current && !oauthPopupRef.current.closed) {\n oauthPopupRef.current.close();\n }\n };\n }, []);\n\n // Find pre-selected provider by UUID in the (allowlist-filtered) catalog list.\n const preselectedProvider = useMemo(() => {\n if (!preselectedProviderId || !providers) return null;\n return providers.find((p: IntegrationProvider) => p.id === preselectedProviderId) || null;\n }, [preselectedProviderId, providers]);\n\n // Fallback by-UUID fetch for providers not in the filtered list (e.g. a\n // built-in hidden by VISIBLE_PROVIDER_KEYS whose detail page still links here).\n // Mirrors the by-key fallback above; prevents a blank-wizard dead-end. Gated on\n // !providersLoading so it only fires once the id is confirmed absent (no\n // redundant fetch for providers that are in the filtered list).\n const { provider: preselectedProviderById, loading: preselectedByIdLoading } = useProvider(\n preselectedProviderId && !preselectedProvider && !providersLoading ? preselectedProviderId : ''\n );\n\n // Determine effective preselected provider — by key (botlit flow), by UUID in\n // the filtered list, then by direct UUID fetch (hidden built-ins).\n const effectivePreselectedProvider = useMemo(\n () => providerByKey ?? preselectedProvider ?? preselectedProviderById,\n [providerByKey, preselectedProvider, preselectedProviderById]\n );\n\n // Set provider on first load if preselected (both flows)\n useEffect(() => {\n if (effectivePreselectedProvider && !selectedProvider && step === 'configure') {\n setSelectedProvider(effectivePreselectedProvider);\n if (!connectionName) {\n setConnectionName(`${effectivePreselectedProvider.name} Connection`);\n }\n }\n }, [effectivePreselectedProvider, selectedProvider, step, connectionName]);\n\n // Filter providers for selection step\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) || (p.description ?? '').toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setStep('configure');\n }, []);\n\n const handleConfigure = useCallback(() => {\n if (!connectionName.trim()) {\n setErrorMessage('Connection name is required');\n return;\n }\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for storing or referencing credentials');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret to reuse');\n return;\n }\n setErrorMessage('');\n setStep('authenticate');\n }, [connectionName, credentialStorage]);\n\n const handleAuthenticate = useCallback(async () => {\n if (!selectedProvider) return;\n\n try {\n setErrorMessage('');\n\n // Build config — in botlit flow, embed returnTo + channelId for backend to use after OAuth completes\n const backendCallbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n\n const connectionConfig: Record<string, unknown> | undefined = isBotlitFlow\n ? { returnTo, channelId }\n : undefined;\n\n // First create the connection (or reuse existing if retrying after failed auth)\n const connId =\n createdConnectionId ??\n (await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim(),\n providerId: selectedProvider.id,\n vaultId: credentialStorage.vaultId,\n credentialSecretId:\n credentialStorage.mode === 'existing' ? credentialStorage.secretId : undefined,\n managedSecretName:\n credentialStorage.mode === 'managed'\n ? credentialStorage.managedSecretName.trim() || undefined\n : undefined,\n ...(connectionConfig ? { config: connectionConfig } : {}),\n }));\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n setStep('error');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Then authenticate based on auth type\n switch (selectedProvider.authType) {\n case 'oauth2': {\n // In botlit flow: redirect to backend callback so it can exchange token + redirect back.\n // In normal flow: use popup + polling pattern with same backend callback URL.\n const result = await initiateOAuth(connId, backendCallbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\n if (isBotlitFlow) {\n // Botlit flow: full-page redirect\n window.location.href = result.redirectUrl;\n return;\n } else {\n // Normal flow: open popup and poll for completion\n const width = 600;\n const height = 700;\n const left = window.screenX + (window.innerWidth - width) / 2;\n const top = window.screenY + (window.innerHeight - height) / 2;\n const popup = window.open(\n result.redirectUrl,\n 'oauth_popup',\n `width=${width},height=${height},left=${left},top=${top},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`\n );\n if (!popup) {\n setErrorMessage(\n 'Popup was blocked. Please allow popups for this site and try again.'\n );\n setStep('error');\n return;\n }\n oauthPopupRef.current = popup;\n setOauthWaiting(true);\n\n oauthCleanupRef.current?.();\n oauthCleanupRef.current = waitForOAuthPopupCompletion({\n connectionId: connId,\n popup,\n fetchConnectionStatus: async () => {\n const { data } = await fetchConnection({ variables: { id: connId } });\n return data?.getConnection ?? null;\n },\n onSuccess: () => {\n setStep('success');\n },\n onError: (message) => {\n setErrorMessage(message);\n setStep('error');\n },\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n }\n setStep('success');\n break;\n }\n case 'api_key':\n if (!apiKey.trim()) {\n setErrorMessage('API key is required');\n return;\n }\n await authenticateWithApiKey(connId, apiKey.trim());\n setStep('success');\n break;\n case 'basic_auth':\n if (!username.trim() || !password.trim()) {\n setErrorMessage('Username and password are required');\n return;\n }\n await authenticateWithBasicAuth(connId, username.trim(), password.trim());\n setStep('success');\n break;\n case 'bearer_token':\n if (!bearerToken.trim()) {\n setErrorMessage('Bearer token is required');\n return;\n }\n await authenticateWithBearerToken(connId, bearerToken.trim());\n setStep('success');\n break;\n default:\n setStep('success');\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Authentication failed');\n setStep('error');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n apiKey,\n username,\n password,\n bearerToken,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateWithApiKey,\n authenticateWithBasicAuth,\n authenticateWithBearerToken,\n isBotlitFlow,\n returnTo,\n channelId,\n apiGatewayUrl,\n createdConnectionId,\n credentialStorage,\n ]);\n\n const handleLinkToChannel = useCallback(() => {\n if (!returnTo || !createdConnectionId) return;\n // Use new URL() with origin base so relative returnTo URLs are handled correctly.\n // Always append both integrationConnectionId AND channelId so BotChannelsTab\n // can call linkIntegrationConnection(integrationConnectionId, channelId).\n const url = new URL(returnTo, window.location.origin);\n url.searchParams.set('integrationConnectionId', createdConnectionId);\n if (channelId) url.searchParams.set('channelId', channelId);\n // Intentionally use pathname+search only to prevent open-redirect vulnerability\n // if returnTo contains a cross-origin absolute URL (navigate only accepts path-relative URLs)\n navigate?.(url.pathname + url.search);\n }, [returnTo, createdConnectionId, channelId, navigate]);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || apiKeyLoading || basicAuthLoading || bearerLoading;\n const isPreselectedLoading = providerKey\n ? providerByKeyLoading\n : providersLoading || preselectedByIdLoading;\n\n const steps = [\n { key: 'select_provider', label: 'Select Provider' },\n { key: 'configure', label: 'Configure' },\n { key: 'authenticate', label: 'Authenticate' },\n ];\n\n const currentStepIndex = steps.findIndex((s) => s.key === step);\n\n if (permissionsLoading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n </div>\n );\n }\n\n if (!canCreate) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-center p-6\">\n <Shield size={48} className=\"text-muted-foreground mb-4\" />\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Access Denied</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n You don&apos;t have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={16} /> Back to Connections\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl mx-auto\">\n {/* Header */}\n <div className=\"flex items-center gap-4\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </button>\n <h1 className=\"text-2xl font-bold text-foreground\">Add Connection</h1>\n {isBotlitFlow && (\n <span className=\"ml-auto text-xs font-medium px-2.5 py-1 rounded-full bg-primary/10 text-primary\">\n Bot Channel Setup\n </span>\n )}\n </div>\n\n {/* Step Indicator */}\n {step !== 'success' && step !== 'error' && (\n <div className=\"flex items-center gap-2\">\n {steps.map((s, i) => (\n <div key={s.key} className=\"flex items-center gap-2\">\n <div\n className={cn(\n 'w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all',\n i < currentStepIndex\n ? 'bg-primary text-primary-foreground'\n : i === currentStepIndex\n ? 'bg-primary text-primary-foreground ring-4 ring-primary/20'\n : 'bg-muted text-muted-foreground'\n )}\n >\n {i < currentStepIndex ? <Check size={16} /> : i + 1}\n </div>\n <span\n className={cn(\n 'text-sm font-medium hidden sm:inline',\n i === currentStepIndex ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {s.label}\n </span>\n {i < steps.length - 1 && <div className=\"w-8 h-px bg-border\" />}\n </div>\n ))}\n </div>\n )}\n\n {/* Error Banner */}\n {errorMessage && step !== 'error' && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-4 flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text flex-shrink-0\" />\n <p className=\"text-sm text-status-error-text\">{errorMessage}</p>\n </div>\n )}\n\n {/* Loading spinner while pre-selected provider resolves */}\n {step === 'configure' && isPreselectedLoading && !selectedProvider && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {/* Pre-selected provider couldn't be resolved (invalid id/key or fetch error) */}\n {step === 'configure' &&\n !isPreselectedLoading &&\n !selectedProvider &&\n (preselectedProviderId || providerKey) && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <AlertCircle size={32} className=\"text-muted-foreground mb-3\" />\n <p className=\"text-sm text-muted-foreground\">This provider isn&apos;t available.</p>\n </div>\n )}\n\n {/* Step 1: Select Provider */}\n {step === 'select_provider' && (\n <div className=\"space-y-4\">\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"text\"\n placeholder=\"Search installed providers...\"\n aria-label=\"Search installed providers\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n {providersLoading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {!providersLoading && filteredProviders.length === 0 && (\n <div className=\"text-center py-12\">\n <p className=\"text-muted-foreground\">\n No installed providers found. Install a provider from the catalog first.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Browse Catalog\n </button>\n </div>\n )}\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n {filteredProviders.map((provider: IntegrationProvider) => (\n <button\n type=\"button\"\n key={provider.id}\n onClick={() => handleSelectProvider(provider)}\n className={cn(\n 'flex items-start gap-3 p-4 rounded-xl border border-border/50 bg-card text-left',\n 'hover:border-primary/50 hover:bg-accent/30 hover:shadow-md transition-all duration-200'\n )}\n >\n <ProviderIcon provider={provider} size={40} />\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-medium text-foreground truncate\">{provider.name}</h3>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {getCategoryLabel(provider.category)} · {getAuthTypeLabel(provider.authType)}\n </p>\n </div>\n </button>\n ))}\n </div>\n </div>\n )}\n\n {/* Step 2: Configure */}\n {step === 'configure' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"flex items-center gap-3 p-4 rounded-xl border border-border/50 bg-card\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <h3 className=\"font-medium text-foreground\">{selectedProvider.name}</h3>\n <p className=\"text-xs text-muted-foreground\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </div>\n\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"conn-name\" className=\"block text-sm font-semibold mb-2\">\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"conn-name\"\n aria-label=\"Connection Name\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder=\"e.g., My Slack Workspace\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"conn-desc\" className=\"block text-sm font-semibold mb-2\">\n Description\n </label>\n <textarea\n id=\"conn-desc\"\n aria-label=\"Description\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n rows={3}\n placeholder=\"Optional description...\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n </div>\n\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() =>\n preselectedProviderId || providerKey\n ? navigate?.(joinPath(basePath, 'connections'))\n : setStep('select_provider')\n }\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Back\n </button>\n <button\n type=\"button\"\n onClick={handleConfigure}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Next <ArrowRight size={16} />\n </button>\n </div>\n </div>\n )}\n\n {/* Step 3: Authenticate */}\n {step === 'authenticate' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-4\">\n <Shield size={18} className=\"text-primary\" />\n Authentication: {getAuthTypeLabel(selectedProvider.authType)}\n </h2>\n\n {selectedProvider.authType === 'oauth2' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n You will be redirected to {selectedProvider.name} to authorize access. After\n granting permission, you'll be redirected back.\n </p>\n <div className=\"p-3 rounded-lg bg-status-info-bg-subtle border border-border-default text-sm text-status-info-text flex items-center gap-2\">\n <ExternalLink size={16} />\n {isBotlitFlow\n ? `You'll be redirected back to the bot channel setup after authorization.`\n : `A new window will open for OAuth authentication`}\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'api_key' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} API key. You can typically find this in your\n account settings.\n </p>\n <div>\n <label htmlFor=\"api-key\" className=\"block text-sm font-semibold mb-2\">\n API Key <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"api-key\"\n aria-label=\"API Key\"\n value={apiKey}\n onChange={(e) => setApiKey(e.target.value)}\n placeholder=\"Enter your API key\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'basic_auth' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} credentials.\n </p>\n <div>\n <label htmlFor=\"username\" className=\"block text-sm font-semibold mb-2\">\n Username <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"username\"\n aria-label=\"Username\"\n value={username}\n onChange={(e) => setUsername(e.target.value)}\n placeholder=\"Username or email\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"password\" className=\"block text-sm font-semibold mb-2\">\n Password <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Lock\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"password\"\n aria-label=\"Password\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n placeholder=\"Password\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'bearer_token' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} bearer token.\n </p>\n <div>\n <label htmlFor=\"bearer-token\" className=\"block text-sm font-semibold mb-2\">\n Bearer Token <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"bearer-token\"\n aria-label=\"Bearer Token\"\n value={bearerToken}\n onChange={(e) => setBearerToken(e.target.value)}\n placeholder=\"Enter your token\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() => setStep('configure')}\n disabled={isAuthenticating}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50\"\n >\n Back\n </button>\n <button\n type=\"button\"\n onClick={handleAuthenticate}\n disabled={isAuthenticating}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50\"\n >\n {isAuthenticating ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : (\n <Check size={16} />\n )}\n {selectedProvider.authType === 'oauth2' ? 'Authorize' : 'Connect'}\n </button>\n </div>\n </div>\n )}\n\n {/* Success */}\n {step === 'success' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Connection Created!</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n Your {selectedProvider?.name} connection has been set up successfully.\n </p>\n <div className=\"flex gap-3\">\n {/* Botlit flow: primary action is linking back to the channel */}\n {isBotlitFlow && createdConnectionId && (\n <button\n type=\"button\"\n onClick={handleLinkToChannel}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Link size={16} />\n Link to Bot Channel\n </button>\n )}\n {/* Normal flow: view the newly created connection */}\n {!isBotlitFlow && createdConnectionId && (\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, `connections/${createdConnectionId}`))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n View Connection\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n All Connections\n </button>\n </div>\n </div>\n )}\n\n {/* Error */}\n {step === 'error' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-error-bg-subtle mb-4\">\n <AlertCircle size={48} className=\"text-status-error-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Connection Failed</h2>\n <p className=\"text-sm text-status-error-text mb-6 max-w-sm\">\n {errorMessage || 'An unexpected error occurred.'}\n </p>\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() => {\n setErrorMessage('');\n setStep('authenticate');\n }}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Try Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;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;GACL"}
1
+ {"version":3,"file":"AddConnectionWizard.js","names":[],"sources":["../../../src/integrations/pages/AddConnectionWizard.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, useEffect, useRef } from 'react';\nimport { useParams, useLocation } from 'react-router-dom';\nimport {\n ArrowLeft,\n ArrowRight,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n Key,\n Lock,\n Shield,\n ExternalLink,\n Link,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { joinPath } from '../utils/navigation';\nimport { getAuthTypeLabel, getCategoryLabel } from '../utils/integrationsHelpers';\nimport { useProviders, useProviderByKey, useProvider } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateWithApiKey,\n useAuthenticateWithBasicAuth,\n useAuthenticateWithBearerToken,\n useAuthenticateWithServiceAccount,\n} from '../hooks/useConnections';\nimport { useGetConnectionLazyQuery } from '../../generated/wspace-operations';\nimport { waitForOAuthPopupCompletion } from '../utils/oauthPopup';\nimport {\n CredentialStorageSelector,\n type CredentialStorageState,\n} from '../components/CredentialStorageSelector';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport type { IntegrationProvider } from '../types';\n\ntype WizardStep = 'select_provider' | 'configure' | 'authenticate' | 'success' | 'error';\n\n/**\n * Add Connection Wizard — multi-step wizard for creating new connections.\n *\n * Supports an optional \"botlit channel flow\" activated by URL search params:\n * ?providerKey=slack-user&returnTo=<url>&channelId=<id>\n *\n * In this flow:\n * - The provider is pre-selected by key (not UUID) and the wizard skips directly to configure.\n * - OAuth redirectUri is set to the backend callback so the backend can exchange the token\n * and redirect back to `returnTo?integrationConnectionId=<id>`.\n * - On success, a \"Link to bot channel\" button navigates to returnTo with the connectionId.\n */\nexport function AddConnectionWizard() {\n const { providerId: preselectedProviderId } = useParams<{ providerId: string }>();\n const { basePath = '/', navigate, apiGatewayUrl } = useIntegrations();\n const routerLocation = useLocation();\n const routerSearch = routerLocation.search;\n\n // ── Parse botlit flow query params ──────────────────────────────────────────\n const searchParams = useMemo(() => new URLSearchParams(routerSearch), [routerSearch]);\n const providerKey = searchParams.get('providerKey') ?? null;\n const returnTo = searchParams.get('returnTo') ?? null;\n const channelId = searchParams.get('channelId') ?? null;\n const isBotlitFlow = Boolean(returnTo && channelId);\n\n // If providerKey is present, look up by key; otherwise fall back to preselectedProviderId (UUID)\n const { provider: providerByKey, loading: providerByKeyLoading } = useProviderByKey(\n providerKey ?? ''\n );\n\n const { providers, loading: providersLoading } = useProviders();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateWithApiKey, loading: apiKeyLoading } = useAuthenticateWithApiKey();\n const { authenticateWithBasicAuth, loading: basicAuthLoading } = useAuthenticateWithBasicAuth();\n const { authenticateWithBearerToken, loading: bearerLoading } = useAuthenticateWithBearerToken();\n const { authenticateWithServiceAccount, loading: serviceAccountLoading } =\n useAuthenticateWithServiceAccount();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Wizard state\n const initialStep: WizardStep =\n preselectedProviderId || providerKey ? 'configure' : 'select_provider';\n const [step, setStep] = useState<WizardStep>(initialStep);\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Form state\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n const [apiKey, setApiKey] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [bearerToken, setBearerToken] = useState('');\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n\n const [errorMessage, setErrorMessage] = useState('');\n const [createdConnectionId, setCreatedConnectionId] = useState<string | null>(null);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n\n // Cleanup OAuth listener and popup on unmount.\n useEffect(() => {\n return () => {\n oauthCleanupRef.current?.();\n if (oauthPopupRef.current && !oauthPopupRef.current.closed) {\n oauthPopupRef.current.close();\n }\n };\n }, []);\n\n // Find pre-selected provider by UUID in the (allowlist-filtered) catalog list.\n const preselectedProvider = useMemo(() => {\n if (!preselectedProviderId || !providers) return null;\n return providers.find((p: IntegrationProvider) => p.id === preselectedProviderId) || null;\n }, [preselectedProviderId, providers]);\n\n // Fallback by-UUID fetch for providers not in the filtered list (e.g. a\n // built-in hidden by VISIBLE_PROVIDER_KEYS whose detail page still links here).\n // Mirrors the by-key fallback above; prevents a blank-wizard dead-end. Gated on\n // !providersLoading so it only fires once the id is confirmed absent (no\n // redundant fetch for providers that are in the filtered list).\n const { provider: preselectedProviderById, loading: preselectedByIdLoading } = useProvider(\n preselectedProviderId && !preselectedProvider && !providersLoading ? preselectedProviderId : ''\n );\n\n // Determine effective preselected provider — by key (botlit flow), by UUID in\n // the filtered list, then by direct UUID fetch (hidden built-ins).\n const effectivePreselectedProvider = useMemo(\n () => providerByKey ?? preselectedProvider ?? preselectedProviderById,\n [providerByKey, preselectedProvider, preselectedProviderById]\n );\n\n // Set provider on first load if preselected (both flows)\n useEffect(() => {\n if (effectivePreselectedProvider && !selectedProvider && step === 'configure') {\n setSelectedProvider(effectivePreselectedProvider);\n if (!connectionName) {\n setConnectionName(`${effectivePreselectedProvider.name} Connection`);\n }\n }\n }, [effectivePreselectedProvider, selectedProvider, step, connectionName]);\n\n // Filter providers for selection step\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) || (p.description ?? '').toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setStep('configure');\n }, []);\n\n const handleConfigure = useCallback(() => {\n if (!connectionName.trim()) {\n setErrorMessage('Connection name is required');\n return;\n }\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for storing or referencing credentials');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret to reuse');\n return;\n }\n setErrorMessage('');\n setStep('authenticate');\n }, [connectionName, credentialStorage]);\n\n const handleAuthenticate = useCallback(async () => {\n if (!selectedProvider) return;\n\n try {\n setErrorMessage('');\n\n // Build config — in botlit flow, embed returnTo + channelId for backend to use after OAuth completes\n const backendCallbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n\n const connectionConfig: Record<string, unknown> | undefined = isBotlitFlow\n ? { returnTo, channelId }\n : undefined;\n\n // First create the connection (or reuse existing if retrying after failed auth)\n const connId =\n createdConnectionId ??\n (await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim(),\n providerId: selectedProvider.id,\n vaultId: credentialStorage.vaultId,\n credentialSecretId:\n credentialStorage.mode === 'existing' ? credentialStorage.secretId : undefined,\n managedSecretName:\n credentialStorage.mode === 'managed'\n ? credentialStorage.managedSecretName.trim() || undefined\n : undefined,\n ...(connectionConfig ? { config: connectionConfig } : {}),\n }));\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n setStep('error');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Then authenticate based on auth type\n switch (selectedProvider.authType) {\n case 'oauth2': {\n // In botlit flow: redirect to backend callback so it can exchange token + redirect back.\n // In normal flow: use popup + polling pattern with same backend callback URL.\n const result = await initiateOAuth(connId, backendCallbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\n if (isBotlitFlow) {\n // Botlit flow: full-page redirect\n window.location.href = result.redirectUrl;\n return;\n } else {\n // Normal flow: open popup and poll for completion\n const width = 600;\n const height = 700;\n const left = window.screenX + (window.innerWidth - width) / 2;\n const top = window.screenY + (window.innerHeight - height) / 2;\n const popup = window.open(\n result.redirectUrl,\n 'oauth_popup',\n `width=${width},height=${height},left=${left},top=${top},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`\n );\n if (!popup) {\n setErrorMessage(\n 'Popup was blocked. Please allow popups for this site and try again.'\n );\n setStep('error');\n return;\n }\n oauthPopupRef.current = popup;\n setOauthWaiting(true);\n\n oauthCleanupRef.current?.();\n oauthCleanupRef.current = waitForOAuthPopupCompletion({\n connectionId: connId,\n popup,\n fetchConnectionStatus: async () => {\n const { data } = await fetchConnection({ variables: { id: connId } });\n return data?.getConnection ?? null;\n },\n onSuccess: () => {\n setStep('success');\n },\n onError: (message) => {\n setErrorMessage(message);\n setStep('error');\n },\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n }\n setStep('success');\n break;\n }\n case 'api_key':\n if (!apiKey.trim()) {\n setErrorMessage('API key is required');\n return;\n }\n await authenticateWithApiKey(connId, apiKey.trim());\n setStep('success');\n break;\n case 'basic_auth':\n if (!username.trim() || !password.trim()) {\n setErrorMessage('Username and password are required');\n return;\n }\n await authenticateWithBasicAuth(connId, username.trim(), password.trim());\n setStep('success');\n break;\n case 'bearer_token':\n if (!bearerToken.trim()) {\n setErrorMessage('Bearer token is required');\n return;\n }\n await authenticateWithBearerToken(connId, bearerToken.trim());\n setStep('success');\n break;\n case 'service_account':\n // First-party provider (e.g. Burdenoff): no user credentials — records\n // the user's delegation/consent; tokens are minted per execution.\n await authenticateWithServiceAccount(\n connId,\n selectedProvider.defaultScopes && selectedProvider.defaultScopes.length > 0\n ? selectedProvider.defaultScopes\n : undefined\n );\n setStep('success');\n break;\n default:\n setStep('success');\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Authentication failed');\n setStep('error');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n apiKey,\n username,\n password,\n bearerToken,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateWithApiKey,\n authenticateWithBasicAuth,\n authenticateWithBearerToken,\n authenticateWithServiceAccount,\n isBotlitFlow,\n returnTo,\n channelId,\n apiGatewayUrl,\n createdConnectionId,\n credentialStorage,\n ]);\n\n const handleLinkToChannel = useCallback(() => {\n if (!returnTo || !createdConnectionId) return;\n // Use new URL() with origin base so relative returnTo URLs are handled correctly.\n // Always append both integrationConnectionId AND channelId so BotChannelsTab\n // can call linkIntegrationConnection(integrationConnectionId, channelId).\n const url = new URL(returnTo, window.location.origin);\n url.searchParams.set('integrationConnectionId', createdConnectionId);\n if (channelId) url.searchParams.set('channelId', channelId);\n // Intentionally use pathname+search only to prevent open-redirect vulnerability\n // if returnTo contains a cross-origin absolute URL (navigate only accepts path-relative URLs)\n navigate?.(url.pathname + url.search);\n }, [returnTo, createdConnectionId, channelId, navigate]);\n\n const isAuthenticating =\n creating ||\n oauthLoading ||\n oauthWaiting ||\n apiKeyLoading ||\n basicAuthLoading ||\n bearerLoading ||\n serviceAccountLoading;\n const isPreselectedLoading = providerKey\n ? providerByKeyLoading\n : providersLoading || preselectedByIdLoading;\n\n const steps = [\n { key: 'select_provider', label: 'Select Provider' },\n { key: 'configure', label: 'Configure' },\n { key: 'authenticate', label: 'Authenticate' },\n ];\n\n const currentStepIndex = steps.findIndex((s) => s.key === step);\n\n if (permissionsLoading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n </div>\n );\n }\n\n if (!canCreate) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-center p-6\">\n <Shield size={48} className=\"text-text-secondary mb-4\" />\n <h2 className=\"text-xl font-bold text-text-primary mb-2\">Access Denied</h2>\n <p className=\"text-sm text-text-secondary mb-6 max-w-sm\">\n You don&apos;t have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={16} /> Back to Connections\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl mx-auto\">\n {/* Header */}\n <div className=\"flex items-center gap-4\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </button>\n <h1 className=\"text-2xl font-bold text-text-primary\">Add Connection</h1>\n {isBotlitFlow && (\n <span className=\"ml-auto text-xs font-medium px-2.5 py-1 rounded-full bg-action-primary-bg/10 text-primary\">\n Bot Channel Setup\n </span>\n )}\n </div>\n\n {/* Step Indicator */}\n {step !== 'success' && step !== 'error' && (\n <div className=\"flex items-center gap-2\">\n {steps.map((s, i) => (\n <div key={s.key} className=\"flex items-center gap-2\">\n <div\n className={cn(\n 'w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all',\n i < currentStepIndex\n ? 'bg-action-primary-bg text-action-primary-text'\n : i === currentStepIndex\n ? 'bg-action-primary-bg text-action-primary-text ring-4 ring-primary/20'\n : 'bg-bg-sunken text-text-secondary'\n )}\n >\n {i < currentStepIndex ? <Check size={16} /> : i + 1}\n </div>\n <span\n className={cn(\n 'text-sm font-medium hidden sm:inline',\n i === currentStepIndex ? 'text-text-primary' : 'text-text-secondary'\n )}\n >\n {s.label}\n </span>\n {i < steps.length - 1 && <div className=\"w-8 h-px bg-border\" />}\n </div>\n ))}\n </div>\n )}\n\n {/* Error Banner */}\n {errorMessage && step !== 'error' && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-4 flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text flex-shrink-0\" />\n <p className=\"text-sm text-status-error-text\">{errorMessage}</p>\n </div>\n )}\n\n {/* Loading spinner while pre-selected provider resolves */}\n {step === 'configure' && isPreselectedLoading && !selectedProvider && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {/* Pre-selected provider couldn't be resolved (invalid id/key or fetch error) */}\n {step === 'configure' &&\n !isPreselectedLoading &&\n !selectedProvider &&\n (preselectedProviderId || providerKey) && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <AlertCircle size={32} className=\"text-text-secondary mb-3\" />\n <p className=\"text-sm text-text-secondary\">This provider isn&apos;t available.</p>\n </div>\n )}\n\n {/* Step 1: Select Provider */}\n {step === 'select_provider' && (\n <div className=\"space-y-4\">\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"text\"\n placeholder=\"Search installed providers...\"\n aria-label=\"Search installed providers\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n {providersLoading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {!providersLoading && filteredProviders.length === 0 && (\n <div className=\"text-center py-12\">\n <p className=\"text-text-secondary\">\n No installed providers found. Install a provider from the catalog first.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Browse Catalog\n </button>\n </div>\n )}\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n {filteredProviders.map((provider: IntegrationProvider) => (\n <button\n type=\"button\"\n key={provider.id}\n onClick={() => handleSelectProvider(provider)}\n className={cn(\n 'flex items-start gap-3 p-4 rounded-xl border border-border-subtle/50 bg-bg-surface text-left',\n 'hover:border-primary/50 hover:bg-accent/30 hover:shadow-md transition-all duration-200'\n )}\n >\n <ProviderIcon provider={provider} size={40} />\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-medium text-text-primary truncate\">{provider.name}</h3>\n <p className=\"text-xs text-text-secondary mt-0.5\">\n {getCategoryLabel(provider.category)} · {getAuthTypeLabel(provider.authType)}\n </p>\n </div>\n </button>\n ))}\n </div>\n </div>\n )}\n\n {/* Step 2: Configure */}\n {step === 'configure' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"flex items-center gap-3 p-4 rounded-xl border border-border-subtle/50 bg-bg-surface\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <h3 className=\"font-medium text-text-primary\">{selectedProvider.name}</h3>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </div>\n\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"conn-name\" className=\"block text-sm font-semibold mb-2\">\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"conn-name\"\n aria-label=\"Connection Name\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder=\"e.g., My Slack Workspace\"\n className=\"w-full px-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"conn-desc\" className=\"block text-sm font-semibold mb-2\">\n Description\n </label>\n <textarea\n id=\"conn-desc\"\n aria-label=\"Description\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n rows={3}\n placeholder=\"Optional description...\"\n className=\"w-full px-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n </div>\n\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() =>\n preselectedProviderId || providerKey\n ? navigate?.(joinPath(basePath, 'connections'))\n : setStep('select_provider')\n }\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors\"\n >\n Back\n </button>\n <button\n type=\"button\"\n onClick={handleConfigure}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Next <ArrowRight size={16} />\n </button>\n </div>\n </div>\n )}\n\n {/* Step 3: Authenticate */}\n {step === 'authenticate' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"rounded-xl border border-border-subtle/50 bg-bg-surface p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-4\">\n <Shield size={18} className=\"text-primary\" />\n Authentication: {getAuthTypeLabel(selectedProvider.authType)}\n </h2>\n\n {selectedProvider.authType === 'oauth2' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n You will be redirected to {selectedProvider.name} to authorize access. After\n granting permission, you'll be redirected back.\n </p>\n <div className=\"p-3 rounded-lg bg-status-info-bg-subtle border border-border-default text-sm text-status-info-text flex items-center gap-2\">\n <ExternalLink size={16} />\n {isBotlitFlow\n ? `You'll be redirected back to the bot channel setup after authorization.`\n : `A new window will open for OAuth authentication`}\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'api_key' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n Enter your {selectedProvider.name} API key. You can typically find this in your\n account settings.\n </p>\n <div>\n <label htmlFor=\"api-key\" className=\"block text-sm font-semibold mb-2\">\n API Key <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"password\"\n id=\"api-key\"\n aria-label=\"API Key\"\n value={apiKey}\n onChange={(e) => setApiKey(e.target.value)}\n placeholder=\"Enter your API key\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'basic_auth' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n Enter your {selectedProvider.name} credentials.\n </p>\n <div>\n <label htmlFor=\"username\" className=\"block text-sm font-semibold mb-2\">\n Username <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"username\"\n aria-label=\"Username\"\n value={username}\n onChange={(e) => setUsername(e.target.value)}\n placeholder=\"Username or email\"\n className=\"w-full px-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"password\" className=\"block text-sm font-semibold mb-2\">\n Password <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Lock\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"password\"\n id=\"password\"\n aria-label=\"Password\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n placeholder=\"Password\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'bearer_token' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-text-secondary\">\n Enter your {selectedProvider.name} bearer token.\n </p>\n <div>\n <label htmlFor=\"bearer-token\" className=\"block text-sm font-semibold mb-2\">\n Bearer Token <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"password\"\n id=\"bearer-token\"\n aria-label=\"Bearer Token\"\n value={bearerToken}\n onChange={(e) => setBearerToken(e.target.value)}\n placeholder=\"Enter your token\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border-subtle rounded-lg bg-bg-surface text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'service_account' && (\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border border-border bg-status-success-bg-subtle p-4\">\n <p className=\"text-sm font-semibold text-foreground\">No credentials needed</p>\n <p className=\"text-sm text-muted-foreground mt-1\">\n {selectedProvider.name} is a first-party integration. Connecting grants{' '}\n {selectedProvider.name} permission to act on your behalf; access tokens are\n issued securely per use — there are no keys or secrets to manage.\n </p>\n {selectedProvider.defaultScopes && selectedProvider.defaultScopes.length > 0 && (\n <p className=\"text-sm text-muted-foreground mt-2\">\n Scopes: {selectedProvider.defaultScopes.join(', ')}\n </p>\n )}\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() => setStep('configure')}\n disabled={isAuthenticating}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors disabled:opacity-50\"\n >\n Back\n </button>\n <button\n type=\"button\"\n onClick={handleAuthenticate}\n disabled={isAuthenticating}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors disabled:opacity-50\"\n >\n {isAuthenticating ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : (\n <Check size={16} />\n )}\n {selectedProvider.authType === 'oauth2' ? 'Authorize' : 'Connect'}\n </button>\n </div>\n </div>\n )}\n\n {/* Success */}\n {step === 'success' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-text-primary mb-2\">Connection Created!</h2>\n <p className=\"text-sm text-text-secondary mb-6 max-w-sm\">\n Your {selectedProvider?.name} connection has been set up successfully.\n </p>\n <div className=\"flex gap-3\">\n {/* Botlit flow: primary action is linking back to the channel */}\n {isBotlitFlow && createdConnectionId && (\n <button\n type=\"button\"\n onClick={handleLinkToChannel}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n <Link size={16} />\n Link to Bot Channel\n </button>\n )}\n {/* Normal flow: view the newly created connection */}\n {!isBotlitFlow && createdConnectionId && (\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, `connections/${createdConnectionId}`))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n View Connection\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors\"\n >\n All Connections\n </button>\n </div>\n </div>\n )}\n\n {/* Error */}\n {step === 'error' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-error-bg-subtle mb-4\">\n <AlertCircle size={48} className=\"text-status-error-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-text-primary mb-2\">Connection Failed</h2>\n <p className=\"text-sm text-status-error-text mb-6 max-w-sm\">\n {errorMessage || 'An unexpected error occurred.'}\n </p>\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() => {\n setErrorMessage('');\n setStep('authenticate');\n }}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Try Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsDA,SAAgB,IAAsB;CACpC,IAAM,EAAE,YAAY,MAA0B,IAAmC,EAC3E,EAAE,cAAW,KAAK,aAAU,qBAAkB,GAAiB,EAE/D,IADiB,IAAa,CACA,QAG9B,IAAe,QAAc,IAAI,gBAAgB,EAAa,EAAE,CAAC,EAAa,CAAC,EAC/E,IAAc,EAAa,IAAI,cAAc,IAAI,MACjD,IAAW,EAAa,IAAI,WAAW,IAAI,MAC3C,IAAY,EAAa,IAAI,YAAY,IAAI,MAC7C,IAAe,GAAQ,KAAY,IAGnC,EAAE,UAAU,GAAe,SAAS,OAAyB,GACjE,KAAe,GAChB,EAEK,EAAE,cAAW,SAAS,MAAqB,IAAc,EACzD,EAAE,mBAAe,WAAW,OAAuB,IAAgB,EACnE,KAAY,GAAc,EAAwB,kBAAkB,EACpE,EAAE,qBAAkB,SAAS,OAAa,IAAqB,EAC/D,EAAE,kBAAe,SAAS,OAAiB,IAAkB,EAC7D,EAAE,2BAAwB,SAAS,OAAkB,IAA2B,EAChF,EAAE,8BAA2B,SAAS,OAAqB,IAA8B,EACzF,EAAE,gCAA6B,SAAS,OAAkB,IAAgC,EAC1F,EAAE,oCAAgC,SAAS,OAC/C,IAAmC,EAC/B,CAAC,MAAmB,GAA0B,EAAE,aAAa,gBAAgB,CAA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;QACL,eAAe,IAAW,EAAS,GAAU,cAAc,CAAC;QAC5D,WAAU;kBACX;QAEQ,CAAA;OACL;;KACF;;GAIP,MAAS,WACR,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,GAAD;OAAa,MAAM;OAAI,WAAU;OAA2B,CAAA;MACxD,CAAA;KACN,kBAAC,MAAD;MAAI,WAAU;gBAA2C;MAAsB,CAAA;KAC/E,kBAAC,KAAD;MAAG,WAAU;gBACV,KAAgB;MACf,CAAA;KACJ,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,UAAD;OACE,MAAK;OACL,eAAe;AAEb,QADA,EAAgB,GAAG,EACnB,EAAQ,eAAe;;OAEzB,WAAU;iBACX;OAEQ,CAAA,EACT,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,IAAW,EAAS,GAAU,cAAc,CAAC;OAC5D,WAAU;iBACX;OAEQ,CAAA,CACL;;KACF;;GAEJ;MAxdJ,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,IAAD;IAAQ,MAAM;IAAI,WAAU;IAA6B,CAAA;GACzD,kBAAC,MAAD;IAAI,WAAU;cAA2C;IAAkB,CAAA;GAC3E,kBAAC,KAAD;IAAG,WAAU;cAA4C;IAErD,CAAA;GACJ,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,IAAW,EAAS,GAAU,cAAc,CAAC;IAC5D,WAAU;cAHZ,CAKE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EAAA,uBAChB;;GACL"}
@@ -32,7 +32,7 @@ function C() {
32
32
  size: 48,
33
33
  className: "animate-spin text-primary"
34
34
  }), /* @__PURE__ */ x("span", {
35
- className: "mt-6 text-sm font-medium text-muted-foreground",
35
+ className: "mt-6 text-sm font-medium text-text-secondary",
36
36
  children: D("integrations.connectionDetail.loading", "Loading connection details...")
37
37
  })]
38
38
  });
@@ -68,7 +68,7 @@ function C() {
68
68
  }), /* @__PURE__ */ S("button", {
69
69
  type: "button",
70
70
  onClick: () => T?.(r(w, "connections")),
71
- className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
71
+ className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors",
72
72
  children: [
73
73
  /* @__PURE__ */ x(p, { size: 14 }),
74
74
  " ",
@@ -122,17 +122,17 @@ function C() {
122
122
  Se && /* @__PURE__ */ x("div", {
123
123
  className: "fixed inset-0 z-50 flex items-center justify-center bg-foreground/40 px-4",
124
124
  children: /* @__PURE__ */ S("div", {
125
- className: "w-full max-w-md rounded-xl border border-border bg-background p-6 shadow-2xl space-y-4",
125
+ className: "w-full max-w-md rounded-xl border border-border-subtle bg-bg-surface p-6 shadow-2xl space-y-4",
126
126
  children: [
127
127
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h2", {
128
- className: "text-lg font-semibold text-foreground",
128
+ className: "text-lg font-semibold text-text-primary",
129
129
  children: "Delete connection"
130
130
  }), /* @__PURE__ */ x("p", {
131
- className: "text-sm text-muted-foreground mt-1",
131
+ className: "text-sm text-text-secondary mt-1",
132
132
  children: "This removes the connection record immediately. You can also remove the mapped vault secret if you no longer need it."
133
133
  })] }),
134
134
  $ && /* @__PURE__ */ S("label", {
135
- className: "flex items-start gap-3 rounded-lg border border-border/60 bg-card px-4 py-3 cursor-pointer",
135
+ className: "flex items-start gap-3 rounded-lg border border-border-subtle/60 bg-bg-surface px-4 py-3 cursor-pointer",
136
136
  children: [/* @__PURE__ */ x("input", {
137
137
  type: "checkbox",
138
138
  checked: K,
@@ -140,10 +140,10 @@ function C() {
140
140
  className: "mt-0.5",
141
141
  "aria-label": "Also remove mapped vault secret"
142
142
  }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
143
- className: "text-sm font-medium text-foreground",
143
+ className: "text-sm font-medium text-text-primary",
144
144
  children: "Also remove mapped vault secret"
145
145
  }), /* @__PURE__ */ x("p", {
146
- className: "text-xs text-muted-foreground mt-1",
146
+ className: "text-xs text-text-secondary mt-1",
147
147
  children: "Use this only if no other connections rely on the same secret."
148
148
  })] })]
149
149
  }),
@@ -154,13 +154,13 @@ function C() {
154
154
  onClick: () => {
155
155
  G(!1), q(!1);
156
156
  },
157
- className: "px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
157
+ className: "px-4 py-2 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors",
158
158
  children: "Cancel"
159
159
  }), /* @__PURE__ */ S("button", {
160
160
  type: "button",
161
161
  onClick: Z,
162
162
  disabled: R,
163
- className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-destructive text-primary-foreground disabled:opacity-50",
163
+ className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-status-error-bg text-action-primary-text disabled:opacity-50",
164
164
  children: [R ? /* @__PURE__ */ x(_, {
165
165
  size: 14,
166
166
  className: "animate-spin"
@@ -183,7 +183,7 @@ function C() {
183
183
  onCancel: () => J(!1)
184
184
  }),
185
185
  /* @__PURE__ */ S("div", {
186
- className: "relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm",
186
+ className: "relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border-subtle/50 p-6 shadow-sm",
187
187
  children: [/* @__PURE__ */ S("div", {
188
188
  className: "relative z-10 flex items-center gap-4",
189
189
  children: [
@@ -203,14 +203,14 @@ function C() {
203
203
  children: [/* @__PURE__ */ S("div", {
204
204
  className: "flex items-center gap-3",
205
205
  children: [/* @__PURE__ */ x("h1", {
206
- className: "text-2xl sm:text-3xl font-bold text-foreground",
206
+ className: "text-2xl sm:text-3xl font-bold text-text-primary",
207
207
  children: O.name
208
208
  }), /* @__PURE__ */ x(ie, {
209
209
  status: O.status,
210
210
  size: "md"
211
211
  })]
212
212
  }), /* @__PURE__ */ S("p", {
213
- className: "text-sm text-muted-foreground mt-0.5",
213
+ className: "text-sm text-text-secondary mt-0.5",
214
214
  children: [
215
215
  O.provider.name,
216
216
  " · ",
@@ -224,9 +224,9 @@ function C() {
224
224
  /* @__PURE__ */ S("div", {
225
225
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
226
226
  children: [/* @__PURE__ */ S("div", {
227
- className: "rounded-xl border border-border/50 bg-card p-5 space-y-4",
227
+ className: "rounded-xl border border-border-subtle/50 bg-bg-surface p-5 space-y-4",
228
228
  children: [/* @__PURE__ */ S("h2", {
229
- className: "font-semibold text-foreground flex items-center gap-2",
229
+ className: "font-semibold text-text-primary flex items-center gap-2",
230
230
  children: [/* @__PURE__ */ x(d, {
231
231
  size: 18,
232
232
  className: "text-primary"
@@ -235,55 +235,55 @@ function C() {
235
235
  className: "space-y-3",
236
236
  children: [
237
237
  O.description && /* @__PURE__ */ S("div", {
238
- className: "py-2 border-b border-border/50",
238
+ className: "py-2 border-b border-border-subtle/50",
239
239
  children: [/* @__PURE__ */ x("span", {
240
- className: "text-xs text-muted-foreground uppercase tracking-wide",
240
+ className: "text-xs text-text-secondary uppercase tracking-wide",
241
241
  children: D("integrations.connectionDetail.fields.description", "Description")
242
242
  }), /* @__PURE__ */ x("p", {
243
- className: "text-sm text-foreground mt-0.5",
243
+ className: "text-sm text-text-primary mt-0.5",
244
244
  children: O.description
245
245
  })]
246
246
  }),
247
247
  /* @__PURE__ */ S("div", {
248
- className: "flex items-center justify-between py-2 border-b border-border/50",
248
+ className: "flex items-center justify-between py-2 border-b border-border-subtle/50",
249
249
  children: [/* @__PURE__ */ x("span", {
250
- className: "text-sm text-muted-foreground",
250
+ className: "text-sm text-text-secondary",
251
251
  children: D("integrations.connectionDetail.fields.provider", "Provider")
252
252
  }), /* @__PURE__ */ x("span", {
253
- className: "text-sm font-medium text-foreground",
253
+ className: "text-sm font-medium text-text-primary",
254
254
  children: O.provider.name
255
255
  })]
256
256
  }),
257
257
  O.externalAccountEmail && /* @__PURE__ */ S("div", {
258
- className: "flex items-center justify-between py-2 border-b border-border/50",
258
+ className: "flex items-center justify-between py-2 border-b border-border-subtle/50",
259
259
  children: [/* @__PURE__ */ S("span", {
260
- className: "text-sm text-muted-foreground flex items-center gap-1",
260
+ className: "text-sm text-text-secondary flex items-center gap-1",
261
261
  children: [
262
262
  /* @__PURE__ */ x(le, { size: 14 }),
263
263
  " ",
264
264
  D("integrations.connectionDetail.fields.account", "Account")
265
265
  ]
266
266
  }), /* @__PURE__ */ x("span", {
267
- className: "text-sm font-medium text-foreground",
267
+ className: "text-sm font-medium text-text-primary",
268
268
  children: O.externalAccountEmail
269
269
  })]
270
270
  }),
271
271
  O.externalAccountName && /* @__PURE__ */ S("div", {
272
- className: "flex items-center justify-between py-2 border-b border-border/50",
272
+ className: "flex items-center justify-between py-2 border-b border-border-subtle/50",
273
273
  children: [/* @__PURE__ */ S("span", {
274
- className: "text-sm text-muted-foreground flex items-center gap-1",
274
+ className: "text-sm text-text-secondary flex items-center gap-1",
275
275
  children: [
276
276
  /* @__PURE__ */ x(fe, { size: 14 }),
277
277
  " ",
278
278
  D("integrations.connectionDetail.fields.name", "Name")
279
279
  ]
280
280
  }), /* @__PURE__ */ x("span", {
281
- className: "text-sm font-medium text-foreground",
281
+ className: "text-sm font-medium text-text-primary",
282
282
  children: O.externalAccountName
283
283
  })]
284
284
  }),
285
285
  O.errorMessage && /* @__PURE__ */ S("div", {
286
- className: "py-2 border-b border-border/50",
286
+ className: "py-2 border-b border-border-subtle/50",
287
287
  children: [/* @__PURE__ */ x("span", {
288
288
  className: "text-xs text-status-error-text uppercase tracking-wide",
289
289
  children: D("integrations.connectionDetail.fields.error", "Error")
@@ -293,36 +293,36 @@ function C() {
293
293
  })]
294
294
  }),
295
295
  /* @__PURE__ */ S("div", {
296
- className: "flex items-center justify-between py-2 border-b border-border/50",
296
+ className: "flex items-center justify-between py-2 border-b border-border-subtle/50",
297
297
  children: [/* @__PURE__ */ S("span", {
298
- className: "text-sm text-muted-foreground flex items-center gap-1",
298
+ className: "text-sm text-text-secondary flex items-center gap-1",
299
299
  children: [
300
300
  /* @__PURE__ */ x(h, { size: 14 }),
301
301
  " ",
302
302
  D("integrations.connectionDetail.fields.lastUsed", "Last Used")
303
303
  ]
304
304
  }), /* @__PURE__ */ x("span", {
305
- className: "text-sm text-foreground",
305
+ className: "text-sm text-text-primary",
306
306
  children: a(O.lastUsedAt)
307
307
  })]
308
308
  }),
309
309
  /* @__PURE__ */ S("div", {
310
- className: "flex items-center justify-between py-2 border-b border-border/50",
310
+ className: "flex items-center justify-between py-2 border-b border-border-subtle/50",
311
311
  children: [/* @__PURE__ */ x("span", {
312
- className: "text-sm text-muted-foreground",
312
+ className: "text-sm text-text-secondary",
313
313
  children: D("integrations.connectionDetail.fields.healthCheck", "Health Check")
314
314
  }), /* @__PURE__ */ x("span", {
315
- className: "text-sm text-foreground",
315
+ className: "text-sm text-text-primary",
316
316
  children: i(O.lastHealthCheck)
317
317
  })]
318
318
  }),
319
319
  /* @__PURE__ */ S("div", {
320
320
  className: "flex items-center justify-between py-2",
321
321
  children: [/* @__PURE__ */ x("span", {
322
- className: "text-sm text-muted-foreground",
322
+ className: "text-sm text-text-secondary",
323
323
  children: D("integrations.connectionDetail.fields.created", "Created")
324
324
  }), /* @__PURE__ */ x("span", {
325
- className: "text-sm text-foreground",
325
+ className: "text-sm text-text-primary",
326
326
  children: i(O.createdAt)
327
327
  })]
328
328
  })
@@ -332,9 +332,9 @@ function C() {
332
332
  className: "space-y-4",
333
333
  children: [
334
334
  /* @__PURE__ */ S("div", {
335
- className: "rounded-xl border border-border/50 bg-card p-5",
335
+ className: "rounded-xl border border-border-subtle/50 bg-bg-surface p-5",
336
336
  children: [/* @__PURE__ */ S("h2", {
337
- className: "font-semibold text-foreground flex items-center gap-2 mb-3",
337
+ className: "font-semibold text-text-primary flex items-center gap-2 mb-3",
338
338
  children: [/* @__PURE__ */ x(v, {
339
339
  size: 18,
340
340
  className: "text-primary"
@@ -342,11 +342,11 @@ function C() {
342
342
  }), O.grantedScopes.length > 0 ? /* @__PURE__ */ x("div", {
343
343
  className: "flex flex-wrap gap-2",
344
344
  children: O.grantedScopes.map((e) => /* @__PURE__ */ x("span", {
345
- className: "text-xs px-2.5 py-1 rounded-full bg-muted text-muted-foreground font-mono",
345
+ className: "text-xs px-2.5 py-1 rounded-full bg-bg-sunken text-text-secondary font-mono",
346
346
  children: e
347
347
  }, e))
348
348
  }) : /* @__PURE__ */ x("p", {
349
- className: "text-sm text-muted-foreground",
349
+ className: "text-sm text-text-secondary",
350
350
  children: D("integrations.connectionDetail.scopes.empty", "No scopes granted.")
351
351
  })]
352
352
  }),
@@ -362,15 +362,15 @@ function C() {
362
362
  children: H.message
363
363
  }),
364
364
  /* @__PURE__ */ x("p", {
365
- className: "text-xs text-muted-foreground mt-1",
365
+ className: "text-xs text-text-secondary mt-1",
366
366
  children: D("integrations.connectionDetail.testResult.latency", "Latency: {latency}ms", { latency: H.latencyMs })
367
367
  })
368
368
  ]
369
369
  }),
370
370
  $ && /* @__PURE__ */ S("div", {
371
- className: "rounded-xl border border-border/50 bg-card p-5",
371
+ className: "rounded-xl border border-border-subtle/50 bg-bg-surface p-5",
372
372
  children: [/* @__PURE__ */ S("h2", {
373
- className: "font-semibold text-foreground flex items-center gap-2 mb-3",
373
+ className: "font-semibold text-text-primary flex items-center gap-2 mb-3",
374
374
  children: [/* @__PURE__ */ x(g, {
375
375
  size: 18,
376
376
  className: "text-primary"
@@ -381,30 +381,30 @@ function C() {
381
381
  O.vaultId && /* @__PURE__ */ S("div", {
382
382
  className: "flex items-center justify-between gap-3",
383
383
  children: [/* @__PURE__ */ x("span", {
384
- className: "text-muted-foreground",
384
+ className: "text-text-secondary",
385
385
  children: "Vault"
386
386
  }), /* @__PURE__ */ x("span", {
387
- className: "font-medium text-foreground break-all",
387
+ className: "font-medium text-text-primary break-all",
388
388
  children: O.vaultId
389
389
  })]
390
390
  }),
391
391
  O.credentialSecretName && /* @__PURE__ */ S("div", {
392
392
  className: "flex items-center justify-between gap-3",
393
393
  children: [/* @__PURE__ */ x("span", {
394
- className: "text-muted-foreground",
394
+ className: "text-text-secondary",
395
395
  children: "Secret"
396
396
  }), /* @__PURE__ */ x("span", {
397
- className: "font-medium text-foreground break-all",
397
+ className: "font-medium text-text-primary break-all",
398
398
  children: O.credentialSecretName
399
399
  })]
400
400
  }),
401
401
  O.credentialSecretId && /* @__PURE__ */ S("div", {
402
402
  className: "flex items-center justify-between gap-3",
403
403
  children: [/* @__PURE__ */ x("span", {
404
- className: "text-muted-foreground",
404
+ className: "text-text-secondary",
405
405
  children: "Secret ID"
406
406
  }), /* @__PURE__ */ x("span", {
407
- className: "font-mono text-xs text-foreground break-all",
407
+ className: "font-mono text-xs text-text-primary break-all",
408
408
  children: O.credentialSecretId
409
409
  })]
410
410
  })
@@ -412,9 +412,9 @@ function C() {
412
412
  })]
413
413
  }),
414
414
  (B || V) && /* @__PURE__ */ S("div", {
415
- className: "rounded-xl border border-border/50 bg-card p-5",
415
+ className: "rounded-xl border border-border-subtle/50 bg-bg-surface p-5",
416
416
  children: [/* @__PURE__ */ S("h2", {
417
- className: "font-semibold text-foreground flex items-center gap-2 mb-3",
417
+ className: "font-semibold text-text-primary flex items-center gap-2 mb-3",
418
418
  children: [/* @__PURE__ */ x(g, {
419
419
  size: 18,
420
420
  className: "text-primary"
@@ -426,7 +426,7 @@ function C() {
426
426
  type: "button",
427
427
  onClick: we,
428
428
  disabled: Q,
429
- className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",
429
+ className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors disabled:opacity-50",
430
430
  children: [N ? /* @__PURE__ */ x(_, {
431
431
  size: 14,
432
432
  className: "animate-spin"
@@ -436,7 +436,7 @@ function C() {
436
436
  type: "button",
437
437
  onClick: Te,
438
438
  disabled: Q,
439
- className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50",
439
+ className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors disabled:opacity-50",
440
440
  children: [F ? /* @__PURE__ */ x(_, {
441
441
  size: 14,
442
442
  className: "animate-spin"