@burdenoff/microfe-integrations 2026.807.2 → 2026.810.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqDH,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAQD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,wBAAwB,sCA+1B1B"}
1
+ {"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqDH,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAQD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,wBAAwB,sCAk2B1B"}
@@ -452,7 +452,7 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
452
452
  }),
453
453
  /* @__PURE__ */ m(ue, {
454
454
  methods: q,
455
- selectedKey: J?.key ?? null,
455
+ selectedKey: F,
456
456
  onSelect: We,
457
457
  disabled: $,
458
458
  idPrefix: K("auth-method")
@@ -1 +1 @@
1
- {"version":3,"file":"AddConnectionDialog.js","names":[],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog -- n8n-style popup for creating new connections.\n *\n * Replaces the full-page AddConnectionWizard with an inline modal dialog.\n * Uses the same hooks and GraphQL operations that already exist in\n * microfe-integrations (useCreateConnection, useInitiateOAuth, etc.).\n *\n * Opens from any page via Zustand store state, so there is no navigation\n * to /connections/add — the dialog overlays the current page.\n */\n\nimport { useState, useMemo, useCallback, useEffect, useRef, useId } from 'react';\nimport {\n X,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n ExternalLink,\n Shield,\n Link2,\n Info,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n getAuthTypeLabel,\n getCategoryLabel,\n legacyFlowForAuthType,\n} from '../utils/integrationsHelpers';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useProviders, useProvider } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateConnection,\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 './CredentialStorageSelector';\nimport { AuthMethodSelector } from './AuthMethodSelector';\nimport { ProviderIcon } from './ProviderIcon';\nimport {\n SchemaForm,\n initialValuesFromSchema,\n isSchemaComplete,\n parseFormSchema,\n visibleValues,\n} from './SchemaForm';\nimport type { IntegrationProvider } from '../types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface AddConnectionDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback to close the dialog */\n onClose: () => void;\n /** Pre-selected provider ID (skips provider picker step) */\n preselectedProviderId?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n}\n\ntype DialogTab = 'connection' | 'details';\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n onConnectionCreated,\n}: AddConnectionDialogProps) {\n // Provider data\n const { apiGatewayUrl } = useIntegrations();\n const { providers, loading: providersLoading } = useProviders();\n // A preselected id may not be in the catalog page (disabled provider linked\n // from its own detail page). Resolve such ids via a direct by-id fetch so the\n // dialog never dead-ends on a blank body.\n const providerInList = useMemo(\n () =>\n preselectedProviderId\n ? ((providers ?? []).find((p: IntegrationProvider) => p.id === preselectedProviderId) ??\n null)\n : null,\n [providers, preselectedProviderId]\n );\n // Only fetch once the catalog has loaded and confirmed the id isn't in the\n // filtered list — avoids a redundant GetProvider for visible providers.\n const { provider: fetchedPreselectedProvider, loading: fetchedPreselectedLoading } = useProvider(\n !providersLoading && preselectedProviderId && !providerInList ? preselectedProviderId : ''\n );\n const resolvedPreselectedProvider = providerInList ?? fetchedPreselectedProvider;\n // True while a preselected provider is still being resolved (catalog load or\n // the by-id fallback fetch) — keeps the body showing a spinner, not blank.\n const preselectedResolving =\n !!preselectedProviderId &&\n !resolvedPreselectedProvider &&\n (providersLoading || fetchedPreselectedLoading);\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n\n // Mutations\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateConnection, loading: authenticating } = useAuthenticateConnection();\n const { authenticateWithServiceAccount, loading: serviceAccountLoading } =\n useAuthenticateWithServiceAccount();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // State\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [showPicker, setShowPicker] = useState(!preselectedProviderId);\n const [activeTab, setActiveTab] = useState<DialogTab>('connection');\n const [searchQuery, setSearchQuery] = useState('');\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n /** Auth method the user picked; null until a provider is selected. */\n const [selectedAuthMethodKey, setSelectedAuthMethodKey] = useState<string | null>(null);\n /** Values for the selected method's schema-described fields. */\n const [fieldValues, setFieldValues] = useState<Record<string, unknown>>({});\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n const [errorMessage, setErrorMessage] = useState('');\n const [success, setSuccess] = useState(false);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n const [, setCreatedConnectionId] = useState<string | null>(null);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const idPrefix = useId();\n const fieldId = (name: string) => `${idPrefix}-${name}`;\n\n // ── Auth method resolution ────────────────────────────────────────────────\n // Everything the auth section renders and submits derives from the selected\n // method. Providers with a single method behave exactly as before.\n const authMethods = useMemo(\n () => (selectedProvider?.authMethods ?? []).filter((method) => method.isEnabled),\n [selectedProvider]\n );\n const selectedAuthMethod = useMemo(\n () =>\n authMethods.find((method) => method.key === selectedAuthMethodKey) ?? authMethods[0] ?? null,\n [authMethods, selectedAuthMethodKey]\n );\n // Fall back to the provider's own authType for providers whose methods have\n // not been fetched (older fragments) or backfilled yet.\n const authFlow = selectedAuthMethod?.flow ?? legacyFlowForAuthType(selectedProvider?.authType);\n const authTypeForMethod = selectedAuthMethod?.authType ?? selectedProvider?.authType;\n // Memoized: a fresh array each render would re-create handleSubmit's\n // useCallback on every render.\n const authScopes = useMemo(\n () =>\n selectedAuthMethod?.defaultScopes?.length\n ? selectedAuthMethod.defaultScopes\n : (selectedProvider?.defaultScopes ?? []),\n [selectedAuthMethod, selectedProvider]\n );\n const activeSchema = useMemo(\n () => parseFormSchema(selectedAuthMethod?.configSchema ?? selectedProvider?.configSchema),\n [selectedAuthMethod, selectedProvider]\n );\n\n // Selecting a different method must not carry the previous method's values\n // over — they belong to a different credential shape entirely.\n useEffect(() => {\n // Seeded from the schema's declared defaults, not empty: a rendered control\n // shows its default as selected, so leaving state empty made validation\n // treat a visible value as missing and dropped it from the submission.\n setFieldValues(initialValuesFromSchema(activeSchema));\n setErrorMessage('');\n // activeSchema is derived from these two, so it is not an extra trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedAuthMethodKey, selectedProvider?.id]);\n\n useEffect(() => {\n if (!open) return undefined;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [open, onClose]);\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 // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveTab('connection');\n setSearchQuery('');\n setConnectionName('');\n setConnectionDescription('');\n setSelectedAuthMethodKey(null);\n setFieldValues({});\n setCredentialStorage({ mode: 'managed', vaultId: '', secretId: '', managedSecretName: '' });\n setErrorMessage('');\n setSuccess(false);\n setOauthWaiting(false);\n setCreatedConnectionId(null);\n\n if (preselectedProviderId) {\n setShowPicker(false);\n setSelectedProvider(null); // will be set by effect below\n } else {\n setShowPicker(true);\n setSelectedProvider(null);\n }\n }\n }, [open, preselectedProviderId]);\n\n // Find and set preselected provider (from the filtered list or, for hidden\n // built-ins, the direct by-id fetch above).\n useEffect(() => {\n if (open && preselectedProviderId && resolvedPreselectedProvider && !selectedProvider) {\n setSelectedProvider(resolvedPreselectedProvider);\n setConnectionName(`${resolvedPreselectedProvider.name} Connection`);\n setShowPicker(false);\n }\n }, [open, preselectedProviderId, resolvedPreselectedProvider, selectedProvider]);\n\n // Auto-focus search input when picker is shown\n useEffect(() => {\n if (open && showPicker) {\n const timeoutId = setTimeout(() => searchInputRef.current?.focus(), 100);\n return () => clearTimeout(timeoutId);\n }\n return undefined;\n }, [open, showPicker]);\n\n // Filter providers for picker\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery.trim()) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) ||\n (p.description ?? '').toLowerCase().includes(q) ||\n p.key.toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n // Group providers by category\n const groupedProviders = useMemo(() => {\n const groups: Record<string, IntegrationProvider[]> = {};\n filteredProviders.forEach((p: IntegrationProvider) => {\n const cat = p.category;\n if (!groups[cat]) groups[cat] = [];\n groups[cat].push(p);\n });\n return groups;\n }, [filteredProviders]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setShowPicker(false);\n setErrorMessage('');\n }, []);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || authenticating || serviceAccountLoading;\n\n // Main submit handler\n const handleSubmit = useCallback(async () => {\n if (!selectedProvider || !connectionName.trim()) return;\n\n // Methods that mint tokens on demand store no credential, so they need no\n // vault/secret — skip the credential-storage requirement entirely.\n const isServiceAccount = authFlow === 'minted';\n\n if (!isServiceAccount) {\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for this connection');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret');\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n );\n return;\n }\n\n try {\n setErrorMessage('');\n\n // Step 1: Create the connection\n const connId = await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim() || undefined,\n providerId: selectedProvider.id,\n authMethodKey: selectedAuthMethodKey ?? undefined,\n // OAuth methods collect non-secret routing settings (tenant subdomain,\n // base URL) rather than a credential, so they belong on the connection\n // config, which getConnectionToken already reads for baseUrl.\n ...(authFlow === 'oauth2' && activeSchema\n ? { config: visibleValues(activeSchema, fieldValues) as Record<string, unknown> }\n : {}),\n ...(isServiceAccount\n ? {}\n : {\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 }),\n });\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Step 2: Authenticate. Driven by the auth method's *flow*, not by a\n // per-auth-type branch: FIELDS methods all submit their schema values\n // through one generic mutation, so adding an auth type needs no new case\n // here and no new mutation to call.\n switch (authFlow) {\n case 'oauth2': {\n const callbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n const result = await initiateOAuth(connId, callbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\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 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 setSuccess(true);\n onConnectionCreated?.(connId);\n },\n onError: setErrorMessage,\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n case 'minted': {\n // Nothing to collect and nothing stored. SERVICE_ACCOUNT still records\n // the user's delegation for the reserved app; WORKSPACE_APP_TOKEN\n // connections are pure config and are already usable.\n if (authTypeForMethod === 'service_account') {\n await authenticateWithServiceAccount(\n connId,\n authScopes.length > 0 ? authScopes : undefined\n );\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n default: {\n // FIELDS: submit whatever the method's schema asked for.\n if (activeSchema) {\n if (!isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n }\n // Only fields the user can currently see: a `showIf` field that was\n // filled and then hidden must not be submitted, or we would store a\n // credential the user no longer intends to send.\n const values: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(visibleValues(activeSchema, fieldValues))) {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed) values[field] = trimmed;\n } else if (value !== undefined && value !== null) {\n values[field] = value;\n }\n }\n await authenticateConnection(connId, selectedAuthMethodKey ?? undefined, values);\n setSuccess(true);\n onConnectionCreated?.(connId);\n }\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Connection failed');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n selectedAuthMethodKey,\n authFlow,\n authTypeForMethod,\n authScopes,\n activeSchema,\n fieldValues,\n selectedAuthMethod,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateConnection,\n authenticateWithServiceAccount,\n apiGatewayUrl,\n onConnectionCreated,\n credentialStorage,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n { key: 'connection', label: 'Connection', icon: Link2 },\n { key: 'details', label: 'Details', icon: Info },\n ];\n\n if (!open) return null;\n\n if (!canCreate && !permissionsLoading) {\n return (\n <>\n <div\n className=\"fixed inset-0 bg-bg-overlay z-50 animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-denied-title\"\n className=\"fixed inset-x-4 top-1/2 z-50 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl border border-border-subtle bg-bg-surface p-8 shadow-2xl text-center\"\n >\n <Shield size={40} className=\"text-text-secondary\" />\n <h2 id=\"add-connection-denied-title\" className=\"text-lg font-semibold text-text-primary\">\n Access Denied\n </h2>\n <p className=\"text-sm text-text-secondary\">\n You don&apos;t have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md border border-border-subtle hover:bg-accent transition-colors\"\n >\n Close\n </button>\n </div>\n </>\n );\n }\n\n return (\n <>\n {/* Backdrop */}\n <div\n className=\"fixed inset-0 bg-bg-overlay z-50 animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n\n {/* Dialog */}\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-dialog-title\"\n className=\"fixed inset-x-4 top-4 bottom-4 z-50 mx-auto flex w-auto max-w-2xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:w-full sm:-translate-y-1/2\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-5 py-4 border-b border-border-subtle flex-shrink-0\">\n <div className=\"flex items-center gap-3\">\n {selectedProvider && !showPicker ? (\n <>\n <ProviderIcon provider={selectedProvider} size={32} />\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n {selectedProvider.name} account\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </>\n ) : (\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n Add new credential\n </h2>\n <p className=\"text-xs text-text-secondary\">\n Select an app or service to connect to\n </p>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {selectedProvider && !showPicker && !success && (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={isAuthenticating || !connectionName.trim()}\n className=\"inline-flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-md 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={14} className=\"animate-spin\" />\n ) : (\n <Check size={14} />\n )}\n {oauthWaiting ? 'Waiting...' : 'Save'}\n </button>\n )}\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary\"\n aria-label=\"Close\"\n >\n <X size={20} />\n </button>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"flex flex-1 min-h-0 overflow-hidden\">\n {/* Provider Picker Mode */}\n {showPicker && !selectedProvider && (\n <div className=\"flex-1 p-5 overflow-y-auto\">\n <p className=\"text-sm text-text-secondary mb-3\">\n Select an app or service to connect to\n </p>\n <div className=\"relative mb-4\">\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n ref={searchInputRef}\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"Search providers...\"\n aria-label=\"Search providers\"\n className=\"w-full pl-9 pr-3 py-2.5 border border-border-subtle rounded-md 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-8\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n ) : filteredProviders.length === 0 ? (\n <IllustratedEmptyState\n illustration={searchQuery ? 'empty-search' : 'empty-data'}\n title={searchQuery ? 'No matching providers' : 'No providers available'}\n description={\n searchQuery\n ? `No installed provider matches “${searchQuery}”. Try a different term.`\n : 'Install and enable a provider from the catalog to create a connection.'\n }\n />\n ) : (\n <div className=\"max-h-[400px] overflow-y-auto space-y-1\">\n {Object.entries(groupedProviders).map(([category, categoryProviders]) => (\n <div key={category}>\n <div className=\"px-2 py-1.5 text-xs font-semibold text-text-secondary uppercase tracking-wider\">\n {getCategoryLabel(category as IntegrationProvider['category'])}\n </div>\n {categoryProviders.map((provider) => (\n <button\n key={provider.id}\n type=\"button\"\n onClick={() => handleSelectProvider(provider)}\n className=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-accent/50 transition-colors text-left\"\n >\n <ProviderIcon provider={provider} size={32} />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-sm font-medium text-text-primary\">\n {provider.name}\n </div>\n <div className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(provider.authType)}\n </div>\n </div>\n </button>\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n\n {/* Loading preselected provider (catalog load or by-id fallback fetch) */}\n {!showPicker && !selectedProvider && preselectedResolving && (\n <div className=\"flex-1 flex items-center justify-center\">\n <Loader2 size={32} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {/* Preselected provider couldn't be resolved (invalid id / fetch error) */}\n {!showPicker && !selectedProvider && !preselectedResolving && preselectedProviderId && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 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 {/* Success State */}\n {success && selectedProvider && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 text-center\">\n <div className=\"p-3 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-1\">Connection Created!</h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n Your {selectedProvider.name} connection has been set up successfully.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Close dialog\n </button>\n </div>\n )}\n\n {/* Form Mode (with sidebar tabs) */}\n {selectedProvider && !showPicker && !success && (\n <>\n {/* Left Sidebar Tabs */}\n <div className=\"w-full border-b border-border-subtle sm:w-40 sm:border-b-0 sm:border-r flex-shrink-0 py-3 overflow-x-auto\">\n {tabs.map((tab) => {\n const TabIcon = tab.icon;\n return (\n <button\n key={tab.key}\n type=\"button\"\n onClick={() => setActiveTab(tab.key)}\n className={cn(\n 'flex min-w-max items-center gap-2 px-4 py-2 text-sm font-medium transition-colors sm:w-full',\n activeTab === tab.key\n ? 'text-text-primary bg-accent/50 border-b-2 border-primary sm:border-b-0 sm:border-l-2'\n : 'text-text-secondary hover:text-text-primary hover:bg-accent/30 border-b-2 border-transparent sm:border-b-0 sm:border-l-2'\n )}\n >\n <TabIcon size={16} />\n {tab.label}\n </button>\n );\n })}\n </div>\n\n {/* Main Content Area */}\n <div className=\"flex-1 p-5 overflow-y-auto\">\n {/* Connection Tab */}\n {activeTab === 'connection' && (\n <div className=\"space-y-5\">\n {/* Error Banner */}\n {errorMessage && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg/10 border border-status-error-border/20\">\n <AlertCircle size={16} className=\"text-status-error-text flex-shrink-0\" />\n <span className=\"text-sm text-status-error-text\">{errorMessage}</span>\n </div>\n )}\n\n {/* Connection Name */}\n <div>\n <label\n htmlFor={fieldId('conn-name')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label=\"Connection Name\"\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={`My ${selectedProvider.name} Connection`}\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor={fieldId('conn-desc')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Description\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label=\"Description\"\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder=\"Optional description\"\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* First-party SERVICE_ACCOUNT connections store no\n credential, so they need no vault/secret picker. */}\n {selectedProvider.authType !== 'service_account' && (\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n )}\n\n {/* Authentication — entirely data-driven.\n The method dropdown appears only when the provider offers\n a choice; the fields below come from that method's\n configSchema, so no provider or auth type has bespoke\n markup here. */}\n <div className=\"rounded-md border border-border-subtle/50 bg-bg-surface p-4 space-y-3\">\n <h3 className=\"font-medium text-text-primary flex items-center gap-2 text-sm\">\n <Shield size={16} className=\"text-primary\" />\n Authentication\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n &middot;{' '}\n {selectedAuthMethod?.displayName ??\n getAuthTypeLabel(selectedProvider.authType)}\n </span>\n )}\n </h3>\n\n <AuthMethodSelector\n methods={authMethods}\n selectedKey={selectedAuthMethod?.key ?? null}\n onSelect={setSelectedAuthMethodKey}\n disabled={isAuthenticating}\n idPrefix={fieldId('auth-method')}\n />\n\n {authFlow === 'oauth2' && (\n <>\n {/* An OAuth method may still declare fields — a tenant\n subdomain, a base URL, bring-your-own-app settings.\n Rendering them only for the `fields` flow made such\n methods impossible to use: the inputs never\n appeared and nothing was ever collected. */}\n {activeSchema && (\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('oauth-cfg')}\n />\n )}\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <ExternalLink\n size={14}\n className=\"text-status-info-text flex-shrink-0\"\n />\n <span className=\"text-xs text-status-info-text\">\n A popup window will open for {selectedProvider.name} sign-in\n </span>\n </div>\n </>\n )}\n\n {authFlow === 'minted' && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Shield size={14} className=\"text-status-info-text flex-shrink-0\" />\n <span className=\"text-xs text-status-info-text\">\n No credentials to enter — access is granted on your behalf and tokens\n are issued per use.\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n Secret values are stored encrypted and never shown again.\n </p>\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('cred')}\n />\n </>\n ) : (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default\">\n <AlertCircle\n size={16}\n className=\"text-status-error-text flex-shrink-0\"\n />\n <span className=\"text-sm text-status-error-text\">\n This authentication method does not declare a configuration form.\n </span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Details Tab */}\n {activeTab === 'details' && (\n <div className=\"space-y-4\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Details</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-3 p-3 rounded-md border border-border-subtle\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {selectedProvider.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)} &middot;{' '}\n {getCategoryLabel(selectedProvider.category)}\n </p>\n </div>\n </div>\n {selectedProvider.description && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Description\n </div>\n <p className=\"text-sm text-text-primary mt-1\">\n {selectedProvider.description}\n </p>\n </div>\n )}\n {selectedProvider.website && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Website\n </div>\n <a\n href={selectedProvider.website}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.website}\n </a>\n </div>\n )}\n {selectedProvider.docsUrl && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Documentation\n </div>\n <a\n href={selectedProvider.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.docsUrl}\n </a>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+EA,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,0BAC2B;CAE3B,IAAM,EAAE,qBAAkB,GAAiB,EACrC,EAAE,cAAW,SAAS,MAAqB,IAAc,EAIzD,IAAiB,QAEnB,KACM,KAAa,EAAE,EAAE,MAAM,MAA2B,EAAE,OAAO,EAAsB,IACnF,OACA,MACN,CAAC,GAAW,EAAsB,CACnC,EAGK,EAAE,UAAU,IAA4B,SAAS,OAA8B,GAC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AC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,GAAD;UAAc,UAAU;UAAkB,MAAM;UAAM,CAAA,EACtD,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;UAAG,WAAU;oBACV,EAAiB;UAChB,CAAA,EACJ,kBAAC,KAAD;UAAG,WAAU;oBAAb;WACG,EAAiB,EAAiB,SAAS;WAAC;WAAU;WACtD,EAAiB,EAAiB,SAAS;WAC1C;YACA,EAAA,CAAA,CACF;;QACL,EAAiB,eAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SACE,MAAM,EAAiB;SACvB,QAAO;SACP,KAAI;SACJ,WAAU;mBAET,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SACE,MAAM,EAAiB;SACvB,QAAO;SACP,KAAI;SACJ,WAAU;mBAET,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEJ;SACF;QAEJ;OACL,EAAA,CAAA;IAED;KACF;IACL,EAAA,CAAA,GA5ca"}
1
+ {"version":3,"file":"AddConnectionDialog.js","names":[],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog -- n8n-style popup for creating new connections.\n *\n * Replaces the full-page AddConnectionWizard with an inline modal dialog.\n * Uses the same hooks and GraphQL operations that already exist in\n * microfe-integrations (useCreateConnection, useInitiateOAuth, etc.).\n *\n * Opens from any page via Zustand store state, so there is no navigation\n * to /connections/add — the dialog overlays the current page.\n */\n\nimport { useState, useMemo, useCallback, useEffect, useRef, useId } from 'react';\nimport {\n X,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n ExternalLink,\n Shield,\n Link2,\n Info,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n getAuthTypeLabel,\n getCategoryLabel,\n legacyFlowForAuthType,\n} from '../utils/integrationsHelpers';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useProviders, useProvider } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateConnection,\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 './CredentialStorageSelector';\nimport { AuthMethodSelector } from './AuthMethodSelector';\nimport { ProviderIcon } from './ProviderIcon';\nimport {\n SchemaForm,\n initialValuesFromSchema,\n isSchemaComplete,\n parseFormSchema,\n visibleValues,\n} from './SchemaForm';\nimport type { IntegrationProvider } from '../types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface AddConnectionDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback to close the dialog */\n onClose: () => void;\n /** Pre-selected provider ID (skips provider picker step) */\n preselectedProviderId?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n}\n\ntype DialogTab = 'connection' | 'details';\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n onConnectionCreated,\n}: AddConnectionDialogProps) {\n // Provider data\n const { apiGatewayUrl } = useIntegrations();\n const { providers, loading: providersLoading } = useProviders();\n // A preselected id may not be in the catalog page (disabled provider linked\n // from its own detail page). Resolve such ids via a direct by-id fetch so the\n // dialog never dead-ends on a blank body.\n const providerInList = useMemo(\n () =>\n preselectedProviderId\n ? ((providers ?? []).find((p: IntegrationProvider) => p.id === preselectedProviderId) ??\n null)\n : null,\n [providers, preselectedProviderId]\n );\n // Only fetch once the catalog has loaded and confirmed the id isn't in the\n // filtered list — avoids a redundant GetProvider for visible providers.\n const { provider: fetchedPreselectedProvider, loading: fetchedPreselectedLoading } = useProvider(\n !providersLoading && preselectedProviderId && !providerInList ? preselectedProviderId : ''\n );\n const resolvedPreselectedProvider = providerInList ?? fetchedPreselectedProvider;\n // True while a preselected provider is still being resolved (catalog load or\n // the by-id fallback fetch) — keeps the body showing a spinner, not blank.\n const preselectedResolving =\n !!preselectedProviderId &&\n !resolvedPreselectedProvider &&\n (providersLoading || fetchedPreselectedLoading);\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n\n // Mutations\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateConnection, loading: authenticating } = useAuthenticateConnection();\n const { authenticateWithServiceAccount, loading: serviceAccountLoading } =\n useAuthenticateWithServiceAccount();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // State\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [showPicker, setShowPicker] = useState(!preselectedProviderId);\n const [activeTab, setActiveTab] = useState<DialogTab>('connection');\n const [searchQuery, setSearchQuery] = useState('');\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n /** Auth method the user picked; null until a provider is selected. */\n const [selectedAuthMethodKey, setSelectedAuthMethodKey] = useState<string | null>(null);\n /** Values for the selected method's schema-described fields. */\n const [fieldValues, setFieldValues] = useState<Record<string, unknown>>({});\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n const [errorMessage, setErrorMessage] = useState('');\n const [success, setSuccess] = useState(false);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n const [, setCreatedConnectionId] = useState<string | null>(null);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const idPrefix = useId();\n const fieldId = (name: string) => `${idPrefix}-${name}`;\n\n // ── Auth method resolution ────────────────────────────────────────────────\n // Everything the auth section renders and submits derives from the selected\n // method. Providers with a single method behave exactly as before.\n const authMethods = useMemo(\n () => (selectedProvider?.authMethods ?? []).filter((method) => method.isEnabled),\n [selectedProvider]\n );\n const selectedAuthMethod = useMemo(\n () =>\n authMethods.find((method) => method.key === selectedAuthMethodKey) ?? authMethods[0] ?? null,\n [authMethods, selectedAuthMethodKey]\n );\n // Fall back to the provider's own authType for providers whose methods have\n // not been fetched (older fragments) or backfilled yet.\n const authFlow = selectedAuthMethod?.flow ?? legacyFlowForAuthType(selectedProvider?.authType);\n const authTypeForMethod = selectedAuthMethod?.authType ?? selectedProvider?.authType;\n // Memoized: a fresh array each render would re-create handleSubmit's\n // useCallback on every render.\n const authScopes = useMemo(\n () =>\n selectedAuthMethod?.defaultScopes?.length\n ? selectedAuthMethod.defaultScopes\n : (selectedProvider?.defaultScopes ?? []),\n [selectedAuthMethod, selectedProvider]\n );\n const activeSchema = useMemo(\n () => parseFormSchema(selectedAuthMethod?.configSchema ?? selectedProvider?.configSchema),\n [selectedAuthMethod, selectedProvider]\n );\n\n // Selecting a different method must not carry the previous method's values\n // over — they belong to a different credential shape entirely.\n useEffect(() => {\n // Seeded from the schema's declared defaults, not empty: a rendered control\n // shows its default as selected, so leaving state empty made validation\n // treat a visible value as missing and dropped it from the submission.\n setFieldValues(initialValuesFromSchema(activeSchema));\n setErrorMessage('');\n // activeSchema is derived from these two, so it is not an extra trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedAuthMethodKey, selectedProvider?.id]);\n\n useEffect(() => {\n if (!open) return undefined;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [open, onClose]);\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 // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveTab('connection');\n setSearchQuery('');\n setConnectionName('');\n setConnectionDescription('');\n setSelectedAuthMethodKey(null);\n setFieldValues({});\n setCredentialStorage({ mode: 'managed', vaultId: '', secretId: '', managedSecretName: '' });\n setErrorMessage('');\n setSuccess(false);\n setOauthWaiting(false);\n setCreatedConnectionId(null);\n\n if (preselectedProviderId) {\n setShowPicker(false);\n setSelectedProvider(null); // will be set by effect below\n } else {\n setShowPicker(true);\n setSelectedProvider(null);\n }\n }\n }, [open, preselectedProviderId]);\n\n // Find and set preselected provider (from the filtered list or, for hidden\n // built-ins, the direct by-id fetch above).\n useEffect(() => {\n if (open && preselectedProviderId && resolvedPreselectedProvider && !selectedProvider) {\n setSelectedProvider(resolvedPreselectedProvider);\n setConnectionName(`${resolvedPreselectedProvider.name} Connection`);\n setShowPicker(false);\n }\n }, [open, preselectedProviderId, resolvedPreselectedProvider, selectedProvider]);\n\n // Auto-focus search input when picker is shown\n useEffect(() => {\n if (open && showPicker) {\n const timeoutId = setTimeout(() => searchInputRef.current?.focus(), 100);\n return () => clearTimeout(timeoutId);\n }\n return undefined;\n }, [open, showPicker]);\n\n // Filter providers for picker\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery.trim()) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) ||\n (p.description ?? '').toLowerCase().includes(q) ||\n p.key.toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n // Group providers by category\n const groupedProviders = useMemo(() => {\n const groups: Record<string, IntegrationProvider[]> = {};\n filteredProviders.forEach((p: IntegrationProvider) => {\n const cat = p.category;\n if (!groups[cat]) groups[cat] = [];\n groups[cat].push(p);\n });\n return groups;\n }, [filteredProviders]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setShowPicker(false);\n setErrorMessage('');\n }, []);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || authenticating || serviceAccountLoading;\n\n // Main submit handler\n const handleSubmit = useCallback(async () => {\n if (!selectedProvider || !connectionName.trim()) return;\n\n // Methods that mint tokens on demand store no credential, so they need no\n // vault/secret — skip the credential-storage requirement entirely.\n const isServiceAccount = authFlow === 'minted';\n\n if (!isServiceAccount) {\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for this connection');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret');\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n );\n return;\n }\n\n try {\n setErrorMessage('');\n\n // Step 1: Create the connection\n const connId = await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim() || undefined,\n providerId: selectedProvider.id,\n authMethodKey: selectedAuthMethodKey ?? undefined,\n // OAuth methods collect non-secret routing settings (tenant subdomain,\n // base URL) rather than a credential, so they belong on the connection\n // config, which getConnectionToken already reads for baseUrl.\n ...(authFlow === 'oauth2' && activeSchema\n ? { config: visibleValues(activeSchema, fieldValues) as Record<string, unknown> }\n : {}),\n ...(isServiceAccount\n ? {}\n : {\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 }),\n });\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Step 2: Authenticate. Driven by the auth method's *flow*, not by a\n // per-auth-type branch: FIELDS methods all submit their schema values\n // through one generic mutation, so adding an auth type needs no new case\n // here and no new mutation to call.\n switch (authFlow) {\n case 'oauth2': {\n const callbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n const result = await initiateOAuth(connId, callbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\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 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 setSuccess(true);\n onConnectionCreated?.(connId);\n },\n onError: setErrorMessage,\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n case 'minted': {\n // Nothing to collect and nothing stored. SERVICE_ACCOUNT still records\n // the user's delegation for the reserved app; WORKSPACE_APP_TOKEN\n // connections are pure config and are already usable.\n if (authTypeForMethod === 'service_account') {\n await authenticateWithServiceAccount(\n connId,\n authScopes.length > 0 ? authScopes : undefined\n );\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n default: {\n // FIELDS: submit whatever the method's schema asked for.\n if (activeSchema) {\n if (!isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n }\n // Only fields the user can currently see: a `showIf` field that was\n // filled and then hidden must not be submitted, or we would store a\n // credential the user no longer intends to send.\n const values: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(visibleValues(activeSchema, fieldValues))) {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed) values[field] = trimmed;\n } else if (value !== undefined && value !== null) {\n values[field] = value;\n }\n }\n await authenticateConnection(connId, selectedAuthMethodKey ?? undefined, values);\n setSuccess(true);\n onConnectionCreated?.(connId);\n }\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Connection failed');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n selectedAuthMethodKey,\n authFlow,\n authTypeForMethod,\n authScopes,\n activeSchema,\n fieldValues,\n selectedAuthMethod,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateConnection,\n authenticateWithServiceAccount,\n apiGatewayUrl,\n onConnectionCreated,\n credentialStorage,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n { key: 'connection', label: 'Connection', icon: Link2 },\n { key: 'details', label: 'Details', icon: Info },\n ];\n\n if (!open) return null;\n\n if (!canCreate && !permissionsLoading) {\n return (\n <>\n <div\n className=\"fixed inset-0 bg-bg-overlay z-50 animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-denied-title\"\n className=\"fixed inset-x-4 top-1/2 z-50 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl border border-border-subtle bg-bg-surface p-8 shadow-2xl text-center\"\n >\n <Shield size={40} className=\"text-text-secondary\" />\n <h2 id=\"add-connection-denied-title\" className=\"text-lg font-semibold text-text-primary\">\n Access Denied\n </h2>\n <p className=\"text-sm text-text-secondary\">\n You don&apos;t have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md border border-border-subtle hover:bg-accent transition-colors\"\n >\n Close\n </button>\n </div>\n </>\n );\n }\n\n return (\n <>\n {/* Backdrop */}\n <div\n className=\"fixed inset-0 bg-bg-overlay z-50 animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n\n {/* Dialog */}\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-dialog-title\"\n className=\"fixed inset-x-4 top-4 bottom-4 z-50 mx-auto flex w-auto max-w-2xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:w-full sm:-translate-y-1/2\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-5 py-4 border-b border-border-subtle flex-shrink-0\">\n <div className=\"flex items-center gap-3\">\n {selectedProvider && !showPicker ? (\n <>\n <ProviderIcon provider={selectedProvider} size={32} />\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n {selectedProvider.name} account\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </>\n ) : (\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n Add new credential\n </h2>\n <p className=\"text-xs text-text-secondary\">\n Select an app or service to connect to\n </p>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {selectedProvider && !showPicker && !success && (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={isAuthenticating || !connectionName.trim()}\n className=\"inline-flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-md 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={14} className=\"animate-spin\" />\n ) : (\n <Check size={14} />\n )}\n {oauthWaiting ? 'Waiting...' : 'Save'}\n </button>\n )}\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary\"\n aria-label=\"Close\"\n >\n <X size={20} />\n </button>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"flex flex-1 min-h-0 overflow-hidden\">\n {/* Provider Picker Mode */}\n {showPicker && !selectedProvider && (\n <div className=\"flex-1 p-5 overflow-y-auto\">\n <p className=\"text-sm text-text-secondary mb-3\">\n Select an app or service to connect to\n </p>\n <div className=\"relative mb-4\">\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n ref={searchInputRef}\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"Search providers...\"\n aria-label=\"Search providers\"\n className=\"w-full pl-9 pr-3 py-2.5 border border-border-subtle rounded-md 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-8\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n ) : filteredProviders.length === 0 ? (\n <IllustratedEmptyState\n illustration={searchQuery ? 'empty-search' : 'empty-data'}\n title={searchQuery ? 'No matching providers' : 'No providers available'}\n description={\n searchQuery\n ? `No installed provider matches “${searchQuery}”. Try a different term.`\n : 'Install and enable a provider from the catalog to create a connection.'\n }\n />\n ) : (\n <div className=\"max-h-[400px] overflow-y-auto space-y-1\">\n {Object.entries(groupedProviders).map(([category, categoryProviders]) => (\n <div key={category}>\n <div className=\"px-2 py-1.5 text-xs font-semibold text-text-secondary uppercase tracking-wider\">\n {getCategoryLabel(category as IntegrationProvider['category'])}\n </div>\n {categoryProviders.map((provider) => (\n <button\n key={provider.id}\n type=\"button\"\n onClick={() => handleSelectProvider(provider)}\n className=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-accent/50 transition-colors text-left\"\n >\n <ProviderIcon provider={provider} size={32} />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-sm font-medium text-text-primary\">\n {provider.name}\n </div>\n <div className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(provider.authType)}\n </div>\n </div>\n </button>\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n\n {/* Loading preselected provider (catalog load or by-id fallback fetch) */}\n {!showPicker && !selectedProvider && preselectedResolving && (\n <div className=\"flex-1 flex items-center justify-center\">\n <Loader2 size={32} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {/* Preselected provider couldn't be resolved (invalid id / fetch error) */}\n {!showPicker && !selectedProvider && !preselectedResolving && preselectedProviderId && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 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 {/* Success State */}\n {success && selectedProvider && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 text-center\">\n <div className=\"p-3 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-1\">Connection Created!</h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n Your {selectedProvider.name} connection has been set up successfully.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Close dialog\n </button>\n </div>\n )}\n\n {/* Form Mode (with sidebar tabs) */}\n {selectedProvider && !showPicker && !success && (\n <>\n {/* Left Sidebar Tabs */}\n <div className=\"w-full border-b border-border-subtle sm:w-40 sm:border-b-0 sm:border-r flex-shrink-0 py-3 overflow-x-auto\">\n {tabs.map((tab) => {\n const TabIcon = tab.icon;\n return (\n <button\n key={tab.key}\n type=\"button\"\n onClick={() => setActiveTab(tab.key)}\n className={cn(\n 'flex min-w-max items-center gap-2 px-4 py-2 text-sm font-medium transition-colors sm:w-full',\n activeTab === tab.key\n ? 'text-text-primary bg-accent/50 border-b-2 border-primary sm:border-b-0 sm:border-l-2'\n : 'text-text-secondary hover:text-text-primary hover:bg-accent/30 border-b-2 border-transparent sm:border-b-0 sm:border-l-2'\n )}\n >\n <TabIcon size={16} />\n {tab.label}\n </button>\n );\n })}\n </div>\n\n {/* Main Content Area */}\n <div className=\"flex-1 p-5 overflow-y-auto\">\n {/* Connection Tab */}\n {activeTab === 'connection' && (\n <div className=\"space-y-5\">\n {/* Error Banner */}\n {errorMessage && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg/10 border border-status-error-border/20\">\n <AlertCircle size={16} className=\"text-status-error-text flex-shrink-0\" />\n <span className=\"text-sm text-status-error-text\">{errorMessage}</span>\n </div>\n )}\n\n {/* Connection Name */}\n <div>\n <label\n htmlFor={fieldId('conn-name')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label=\"Connection Name\"\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={`My ${selectedProvider.name} Connection`}\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor={fieldId('conn-desc')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Description\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label=\"Description\"\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder=\"Optional description\"\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* First-party SERVICE_ACCOUNT connections store no\n credential, so they need no vault/secret picker. */}\n {selectedProvider.authType !== 'service_account' && (\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n )}\n\n {/* Authentication — entirely data-driven.\n The method dropdown appears only when the provider offers\n a choice; the fields below come from that method's\n configSchema, so no provider or auth type has bespoke\n markup here. */}\n <div className=\"rounded-md border border-border-subtle/50 bg-bg-surface p-4 space-y-3\">\n <h3 className=\"font-medium text-text-primary flex items-center gap-2 text-sm\">\n <Shield size={16} className=\"text-primary\" />\n Authentication\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n &middot;{' '}\n {selectedAuthMethod?.displayName ??\n getAuthTypeLabel(selectedProvider.authType)}\n </span>\n )}\n </h3>\n\n <AuthMethodSelector\n methods={authMethods}\n // Raw key, not the resolved method: the selector needs\n // to see null vs stale itself, or its placeholder can\n // never render.\n selectedKey={selectedAuthMethodKey}\n onSelect={setSelectedAuthMethodKey}\n disabled={isAuthenticating}\n idPrefix={fieldId('auth-method')}\n />\n\n {authFlow === 'oauth2' && (\n <>\n {/* An OAuth method may still declare fields — a tenant\n subdomain, a base URL, bring-your-own-app settings.\n Rendering them only for the `fields` flow made such\n methods impossible to use: the inputs never\n appeared and nothing was ever collected. */}\n {activeSchema && (\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('oauth-cfg')}\n />\n )}\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <ExternalLink\n size={14}\n className=\"text-status-info-text flex-shrink-0\"\n />\n <span className=\"text-xs text-status-info-text\">\n A popup window will open for {selectedProvider.name} sign-in\n </span>\n </div>\n </>\n )}\n\n {authFlow === 'minted' && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Shield size={14} className=\"text-status-info-text flex-shrink-0\" />\n <span className=\"text-xs text-status-info-text\">\n No credentials to enter — access is granted on your behalf and tokens\n are issued per use.\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n Secret values are stored encrypted and never shown again.\n </p>\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('cred')}\n />\n </>\n ) : (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default\">\n <AlertCircle\n size={16}\n className=\"text-status-error-text flex-shrink-0\"\n />\n <span className=\"text-sm text-status-error-text\">\n This authentication method does not declare a configuration form.\n </span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Details Tab */}\n {activeTab === 'details' && (\n <div className=\"space-y-4\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Details</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-3 p-3 rounded-md border border-border-subtle\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {selectedProvider.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)} &middot;{' '}\n {getCategoryLabel(selectedProvider.category)}\n </p>\n </div>\n </div>\n {selectedProvider.description && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Description\n </div>\n <p className=\"text-sm text-text-primary mt-1\">\n {selectedProvider.description}\n </p>\n </div>\n )}\n {selectedProvider.website && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Website\n </div>\n <a\n href={selectedProvider.website}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.website}\n </a>\n </div>\n )}\n {selectedProvider.docsUrl && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Documentation\n </div>\n <a\n href={selectedProvider.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.docsUrl}\n </a>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+EA,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,0BAC2B;CAE3B,IAAM,EAAE,qBAAkB,GAAiB,EACrC,EAAE,cAAW,SAAS,MAAqB,IAAc,EAIzD,IAAiB,QAEnB,KACM,KAAa,EAAE,EAAE,MAAM,MAA2B,EAAE,OAAO,EAAsB,IACnF,OACA,MACN,CAAC,GAAW,EAAsB,CACnC,EAGK,EAAE,UAAU,IAA4B,SAAS,OAA8B,GACnF,CAAC,KAAoB,KAAyB,CAAC,IAAiB,IAAwB,GACzF,EACK,IAA8B,KAAkB,IAGhD,IACJ,CAAC,CAAC,KACF,CAAC,MACA,KAAoB,KACjB,EAAE,mBAAe,WAAW,OAAuB,IAAgB,EACnE,KAAY,CAAC,MAAsB,GAAc,EAAwB,kBAAkB,EAG3F,EAAE,sBAAkB,SAAS,OAAa,IAAqB,EAC/D,EAAE,mBAAe,SAAS,OAAiB,IAAkB,EAC7D,EAAE,4BAAwB,SAAS,OAAmB,IAA2B,EACjF,EAAE,oCAAgC,SAA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AAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SACE,MAAM,EAAiB;SACvB,QAAO;SACP,KAAI;SACJ,WAAU;mBAET,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SACE,MAAM,EAAiB;SACvB,QAAO;SACP,KAAI;SACJ,WAAU;mBAET,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEJ;SACF;QAEJ;OACL,EAAA,CAAA;IAED;KACF;IACL,EAAA,CAAA,GA/ca"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuthMethodSelector.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AuthMethodSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAmD1D,CAAC"}
1
+ {"version":3,"file":"AuthMethodSelector.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AuthMethodSelector.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAkE1D,CAAC"}
@@ -4,7 +4,7 @@ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
4
  var r = ({ methods: r, selectedKey: i, onSelect: a, disabled: o, idPrefix: s = "auth-method" }) => {
5
5
  let c = r.filter((e) => e.isEnabled);
6
6
  if (c.length <= 1) return null;
7
- let l = c.find((e) => e.key === i) ?? null;
7
+ let l = c.find((e) => e.key === i) ?? null ?? (i ? null : c[0] ?? null);
8
8
  return /* @__PURE__ */ n("div", { children: [
9
9
  /* @__PURE__ */ n("label", {
10
10
  htmlFor: s,
@@ -14,18 +14,22 @@ var r = ({ methods: r, selectedKey: i, onSelect: a, disabled: o, idPrefix: s = "
14
14
  children: "*"
15
15
  })]
16
16
  }),
17
- /* @__PURE__ */ t("select", {
17
+ /* @__PURE__ */ n("select", {
18
18
  id: s,
19
19
  "aria-label": "Authentication Method",
20
- value: i ?? "",
20
+ value: l ? l.key : "",
21
21
  onChange: (e) => a(e.target.value),
22
22
  disabled: o,
23
23
  className: "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50",
24
- children: c.map((e) => /* @__PURE__ */ n("option", {
24
+ children: [!l && /* @__PURE__ */ t("option", {
25
+ value: "",
26
+ disabled: !0,
27
+ children: "Select an authentication method"
28
+ }), c.map((e) => /* @__PURE__ */ n("option", {
25
29
  value: e.key,
26
30
  disabled: !e.isConfigured,
27
31
  children: [e.displayName, e.isConfigured ? "" : " — not configured"]
28
- }, e.key))
32
+ }, e.key))]
29
33
  }),
30
34
  l?.description && /* @__PURE__ */ t("p", {
31
35
  className: "mt-1 text-xs text-text-secondary",
@@ -1 +1 @@
1
- {"version":3,"file":"AuthMethodSelector.js","names":[],"sources":["../../../src/integrations/components/AuthMethodSelector.tsx"],"sourcesContent":["/**\n * AuthMethodSelector — lets the user choose how to authenticate when a provider\n * offers more than one way (e.g. Gmail via OAuth or via a service account).\n *\n * Renders nothing when there is only one method, so the ~30 single-method\n * providers look exactly as they did before multi-auth existed.\n */\nimport type { FC } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport type { IntegrationAuthMethod } from '../types';\n\ninterface AuthMethodSelectorProps {\n methods: IntegrationAuthMethod[];\n selectedKey: string | null;\n onSelect: (key: string) => void;\n disabled?: boolean;\n idPrefix?: string;\n}\n\nexport const AuthMethodSelector: FC<AuthMethodSelectorProps> = ({\n methods,\n selectedKey,\n onSelect,\n disabled,\n idPrefix = 'auth-method',\n}) => {\n const selectable = methods.filter((method) => method.isEnabled);\n if (selectable.length <= 1) return null;\n\n const selected = selectable.find((method) => method.key === selectedKey) ?? null;\n\n return (\n <div>\n <label htmlFor={idPrefix} className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Authentication Method <span className=\"text-status-error-text\">*</span>\n </label>\n <select\n id={idPrefix}\n aria-label=\"Authentication Method\"\n value={selectedKey ?? ''}\n onChange={(event) => onSelect(event.target.value)}\n disabled={disabled}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n >\n {selectable.map((method) => (\n <option key={method.key} value={method.key} disabled={!method.isConfigured}>\n {method.displayName}\n {/* Unconfigured methods stay listed rather than disappearing — a\n documented option vanishing reads as a bug, whereas a labelled\n one tells the user exactly what to ask an admin for — but they\n are not selectable, so the dialog cannot create a connection\n that is guaranteed to fail at authentication. */}\n {method.isConfigured ? '' : ' — not configured'}\n </option>\n ))}\n </select>\n {selected?.description && (\n <p className=\"mt-1 text-xs text-text-secondary\">{selected.description}</p>\n )}\n {selected && !selected.isConfigured && (\n <div className=\"mt-2 flex items-start gap-2 px-3 py-2 rounded-md bg-status-warning-bg-subtle border border-border-default\">\n <AlertCircle size={14} className=\"text-status-warning-text flex-shrink-0 mt-0.5\" />\n <span className=\"text-xs text-status-warning-text\">\n This method has no credentials configured in this environment. Ask an administrator to\n add them, or pick another method.\n </span>\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;AAmBA,IAAa,KAAmD,EAC9D,YACA,gBACA,aACA,aACA,cAAW,oBACP;CACJ,IAAM,IAAa,EAAQ,QAAQ,MAAW,EAAO,UAAU;AAC/D,KAAI,EAAW,UAAU,EAAG,QAAO;CAEnC,IAAM,IAAW,EAAW,MAAM,MAAW,EAAO,QAAQ,EAAY,IAAI;AAE5E,QACE,kBAAC,OAAD,EAAA,UAAA;EACE,kBAAC,SAAD;GAAO,SAAS;GAAU,WAAU;aAApC,CAAyF,0BACjE,kBAAC,QAAD;IAAM,WAAU;cAAyB;IAAQ,CAAA,CACjE;;EACR,kBAAC,UAAD;GACE,IAAI;GACJ,cAAW;GACX,OAAO,KAAe;GACtB,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;GACvC;GACV,WAAU;aAET,EAAW,KAAK,MACf,kBAAC,UAAD;IAAyB,OAAO,EAAO;IAAK,UAAU,CAAC,EAAO;cAA9D,CACG,EAAO,aAMP,EAAO,eAAe,KAAK,oBACrB;MARI,EAAO,IAQX,CACT;GACK,CAAA;EACR,GAAU,eACT,kBAAC,KAAD;GAAG,WAAU;aAAoC,EAAS;GAAgB,CAAA;EAE3E,KAAY,CAAC,EAAS,gBACrB,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,GAAD;IAAa,MAAM;IAAI,WAAU;IAAkD,CAAA,EACnF,kBAAC,QAAD;IAAM,WAAU;cAAmC;IAG5C,CAAA,CACH;;EAEJ,EAAA,CAAA"}
1
+ {"version":3,"file":"AuthMethodSelector.js","names":[],"sources":["../../../src/integrations/components/AuthMethodSelector.tsx"],"sourcesContent":["/**\n * AuthMethodSelector — lets the user choose how to authenticate when a provider\n * offers more than one way (e.g. Gmail via OAuth or via a service account).\n *\n * Renders nothing when there is only one method, so the ~30 single-method\n * providers look exactly as they did before multi-auth existed.\n */\nimport type { FC } from 'react';\nimport { AlertCircle } from 'lucide-react';\nimport type { IntegrationAuthMethod } from '../types';\n\ninterface AuthMethodSelectorProps {\n methods: IntegrationAuthMethod[];\n selectedKey: string | null;\n onSelect: (key: string) => void;\n disabled?: boolean;\n idPrefix?: string;\n}\n\nexport const AuthMethodSelector: FC<AuthMethodSelectorProps> = ({\n methods,\n selectedKey,\n onSelect,\n disabled,\n idPrefix = 'auth-method',\n}) => {\n const selectable = methods.filter((method) => method.isEnabled);\n if (selectable.length <= 1) return null;\n\n // Resolve here rather than relying on the caller: a null key means \"the\n // provider's default\", which is what submission will use, so the dropdown\n // must show that method rather than an empty box. A *stale* key — one that\n // matches nothing after switching providers or a method being removed — is\n // the only case that should surface the placeholder.\n const matched = selectable.find((method) => method.key === selectedKey) ?? null;\n const selected = matched ?? (selectedKey ? null : (selectable[0] ?? null));\n\n return (\n <div>\n <label htmlFor={idPrefix} className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Authentication Method <span className=\"text-status-error-text\">*</span>\n </label>\n <select\n id={idPrefix}\n aria-label=\"Authentication Method\"\n value={selected ? selected.key : ''}\n onChange={(event) => onSelect(event.target.value)}\n disabled={disabled}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n >\n {/* Rendered whenever nothing matches — a null key, or a stale one after\n switching providers or a method being removed. Without it the\n browser shows the first method as selected while state says\n otherwise, and picking that method fires no change event. */}\n {!selected && (\n <option value=\"\" disabled>\n Select an authentication method\n </option>\n )}\n {selectable.map((method) => (\n <option key={method.key} value={method.key} disabled={!method.isConfigured}>\n {method.displayName}\n {/* Unconfigured methods stay listed rather than disappearing — a\n documented option vanishing reads as a bug, whereas a labelled\n one tells the user exactly what to ask an admin for — but they\n are not selectable, so the dialog cannot create a connection\n that is guaranteed to fail at authentication. */}\n {method.isConfigured ? '' : ' — not configured'}\n </option>\n ))}\n </select>\n {selected?.description && (\n <p className=\"mt-1 text-xs text-text-secondary\">{selected.description}</p>\n )}\n {selected && !selected.isConfigured && (\n <div className=\"mt-2 flex items-start gap-2 px-3 py-2 rounded-md bg-status-warning-bg-subtle border border-border-default\">\n <AlertCircle size={14} className=\"text-status-warning-text flex-shrink-0 mt-0.5\" />\n <span className=\"text-xs text-status-warning-text\">\n This method has no credentials configured in this environment. Ask an administrator to\n add them, or pick another method.\n </span>\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;AAmBA,IAAa,KAAmD,EAC9D,YACA,gBACA,aACA,aACA,cAAW,oBACP;CACJ,IAAM,IAAa,EAAQ,QAAQ,MAAW,EAAO,UAAU;AAC/D,KAAI,EAAW,UAAU,EAAG,QAAO;CAQnC,IAAM,IADU,EAAW,MAAM,MAAW,EAAO,QAAQ,EAAY,IAAI,SAC9C,IAAc,OAAQ,EAAW,MAAM;AAEpE,QACE,kBAAC,OAAD,EAAA,UAAA;EACE,kBAAC,SAAD;GAAO,SAAS;GAAU,WAAU;aAApC,CAAyF,0BACjE,kBAAC,QAAD;IAAM,WAAU;cAAyB;IAAQ,CAAA,CACjE;;EACR,kBAAC,UAAD;GACE,IAAI;GACJ,cAAW;GACX,OAAO,IAAW,EAAS,MAAM;GACjC,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;GACvC;GACV,WAAU;aANZ,CAYG,CAAC,KACA,kBAAC,UAAD;I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AAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2B1C,CAAC"}
@@ -32,8 +32,14 @@ function l(e) {
32
32
  }
33
33
  function u(e) {
34
34
  if (!e) return {};
35
- let t = {};
36
- for (let [n, r] of Object.entries(e.properties)) r.default !== void 0 && (t[n] = r.default);
35
+ let t = {}, n = new Set(e.required);
36
+ for (let [r, i] of Object.entries(e.properties)) {
37
+ if (i.default !== void 0) {
38
+ t[r] = i.default;
39
+ continue;
40
+ }
41
+ i.type === "boolean" && n.has(r) && (t[r] = !1);
42
+ }
37
43
  return t;
38
44
  }
39
45
  function d(e, t) {
@@ -45,11 +51,11 @@ function d(e, t) {
45
51
  }
46
52
  return n;
47
53
  }
48
- var f = ({ schema: e, values: t, onChange: n, disabled: r, idPrefix: a = "schema" }) => {
54
+ var f = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("-webkit-text-security", "disc"), p = ({ schema: e, values: t, onChange: n, disabled: r, idPrefix: a = "schema" }) => {
49
55
  let o = new Set(e.required);
50
56
  return /* @__PURE__ */ i("div", {
51
57
  className: "space-y-3",
52
- children: Object.entries(e.properties).filter(([, e]) => s(e, t)).map(([e, s]) => /* @__PURE__ */ i(p, {
58
+ children: Object.entries(e.properties).filter(([, e]) => s(e, t)).map(([e, s]) => /* @__PURE__ */ i(m, {
53
59
  id: `${a}-${e}`,
54
60
  name: e,
55
61
  property: s,
@@ -62,8 +68,8 @@ var f = ({ schema: e, values: t, onChange: n, disabled: r, idPrefix: a = "schema
62
68
  })
63
69
  }, e))
64
70
  });
65
- }, p = ({ id: o, name: s, property: c, value: u, required: d, disabled: f, onChange: p }) => {
66
- let [m, h] = e(!1), g = c.title ?? s, _ = c.placeholder ?? c.description ?? "";
71
+ }, m = ({ id: o, name: s, property: c, value: u, required: d, disabled: p, onChange: m }) => {
72
+ let [h, g] = e(!1), [_, v] = e(!1), y = c.title ?? s, b = c.placeholder ?? c.description ?? "";
67
73
  if (c.type === "notice") return /* @__PURE__ */ a("div", {
68
74
  className: "flex items-start gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
69
75
  children: [/* @__PURE__ */ i(r, {
@@ -71,24 +77,24 @@ var f = ({ schema: e, values: t, onChange: n, disabled: r, idPrefix: a = "schema
71
77
  className: "text-status-info-text flex-shrink-0 mt-0.5"
72
78
  }), /* @__PURE__ */ i("span", {
73
79
  className: "text-xs text-status-info-text",
74
- children: c.description ?? g
80
+ children: c.description ?? y
75
81
  })]
76
82
  });
77
- let v = c.description ? /* @__PURE__ */ i("p", {
83
+ let x = c.description ? /* @__PURE__ */ i("p", {
78
84
  className: "mt-1 text-xs text-text-secondary",
79
85
  children: c.description
80
- }) : null, y = /* @__PURE__ */ a("label", {
86
+ }) : null, S = /* @__PURE__ */ a("label", {
81
87
  htmlFor: o,
82
88
  className: "block text-sm font-medium text-text-primary mb-1.5",
83
89
  children: [
84
- g,
90
+ y,
85
91
  " ",
86
92
  d && /* @__PURE__ */ i("span", {
87
93
  className: "text-status-error-text",
88
94
  children: "*"
89
95
  })
90
96
  ]
91
- }), b = "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50";
97
+ }), C = "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50";
92
98
  if (c.type === "boolean") {
93
99
  let e = !!(u ?? c.default ?? !1);
94
100
  return /* @__PURE__ */ a("div", {
@@ -98,92 +104,127 @@ var f = ({ schema: e, values: t, onChange: n, disabled: r, idPrefix: a = "schema
98
104
  role: "switch",
99
105
  id: o,
100
106
  "aria-checked": e,
101
- "aria-label": g,
102
- onClick: () => p(!e),
103
- disabled: f,
107
+ "aria-label": y,
108
+ onClick: () => m(!e),
109
+ disabled: p,
104
110
  className: `relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${e ? "bg-primary" : "bg-bg-muted"}`,
105
111
  children: /* @__PURE__ */ i("span", { className: `inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${e ? "translate-x-4.5" : "translate-x-0.5"}` })
106
112
  }), /* @__PURE__ */ a("span", {
107
113
  className: "text-sm font-medium text-text-primary",
108
- children: [g, c.description && /* @__PURE__ */ a("span", {
114
+ children: [y, c.description && /* @__PURE__ */ a("span", {
109
115
  className: "text-text-secondary font-normal ml-1",
110
116
  children: ["— ", c.description]
111
117
  })]
112
118
  })]
113
119
  });
114
120
  }
115
- return c.enum && c.enum.length > 0 ? /* @__PURE__ */ a("div", { children: [
116
- y,
121
+ if (c.enum && c.enum.length > 0) return /* @__PURE__ */ a("div", { children: [
122
+ S,
117
123
  /* @__PURE__ */ a("select", {
118
124
  id: o,
119
- "aria-label": g,
125
+ "aria-label": y,
120
126
  value: String(u ?? c.default ?? ""),
121
- onChange: (e) => p(e.target.value),
122
- disabled: f,
123
- className: b,
127
+ onChange: (e) => m(e.target.value),
128
+ disabled: p,
129
+ className: C,
124
130
  children: [/* @__PURE__ */ a("option", {
125
131
  value: "",
126
- children: ["Select ", g.toLowerCase()]
132
+ children: ["Select ", y.toLowerCase()]
127
133
  }), l(c.enum).map((e) => /* @__PURE__ */ i("option", {
128
134
  value: e.value,
129
135
  children: e.label
130
136
  }, e.value))]
131
137
  }),
132
- v
133
- ] }) : c.type === "number" ? /* @__PURE__ */ a("div", { children: [
134
- y,
138
+ x
139
+ ] });
140
+ if (c.type === "number") return /* @__PURE__ */ a("div", { children: [
141
+ S,
135
142
  /* @__PURE__ */ i("input", {
136
143
  id: o,
137
- "aria-label": g,
144
+ "aria-label": y,
138
145
  type: "number",
139
146
  value: u == null ? "" : String(u),
140
- onChange: (e) => p(e.target.value === "" ? void 0 : Number(e.target.value)),
141
- placeholder: _,
142
- disabled: f,
143
- className: b
144
- }),
145
- v
146
- ] }) : c.format === "textarea" || c.format === "json" ? /* @__PURE__ */ a("div", { children: [
147
- y,
148
- /* @__PURE__ */ i("textarea", {
149
- id: o,
150
- "aria-label": g,
151
- value: String(u ?? ""),
152
- onChange: (e) => p(e.target.value),
153
- placeholder: _,
154
- disabled: f,
155
- rows: 5,
156
- autoComplete: "off",
157
- spellCheck: !1,
158
- className: `${b} font-mono`
147
+ onChange: (e) => m(e.target.value === "" ? void 0 : Number(e.target.value)),
148
+ placeholder: b,
149
+ disabled: p,
150
+ className: C
159
151
  }),
160
- v
161
- ] }) : /* @__PURE__ */ a("div", { children: [
162
- y,
152
+ x
153
+ ] });
154
+ if (c.format === "textarea" || c.format === "json") {
155
+ let e = !!c.secret && !h, r = typeof u == "string" && u.length > 0;
156
+ return e && !f && r && !_ ? /* @__PURE__ */ a("div", { children: [
157
+ S,
158
+ /* @__PURE__ */ a("div", {
159
+ className: "flex items-center justify-between gap-2 px-3 py-2 border border-border-subtle rounded-md bg-bg-surface",
160
+ children: [/* @__PURE__ */ i("span", {
161
+ className: "text-sm font-mono text-text-secondary select-none",
162
+ children: "••••••••••••"
163
+ }), /* @__PURE__ */ a("button", {
164
+ type: "button",
165
+ onClick: () => g(!0),
166
+ disabled: p,
167
+ "aria-label": `Show ${y}`,
168
+ className: "inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",
169
+ children: [/* @__PURE__ */ i(t, { size: 14 }), " Reveal to edit"]
170
+ })]
171
+ }),
172
+ x
173
+ ] }) : /* @__PURE__ */ a("div", { children: [
174
+ S,
175
+ /* @__PURE__ */ a("div", {
176
+ className: "relative",
177
+ children: [/* @__PURE__ */ i("textarea", {
178
+ id: o,
179
+ "aria-label": y,
180
+ value: String(u ?? ""),
181
+ onChange: (e) => m(e.target.value),
182
+ onFocus: () => v(!0),
183
+ onBlur: () => v(!1),
184
+ placeholder: b,
185
+ disabled: p,
186
+ rows: 5,
187
+ autoComplete: "off",
188
+ spellCheck: !1,
189
+ style: e ? { WebkitTextSecurity: "disc" } : void 0,
190
+ className: `${C} font-mono ${c.secret ? "pr-10" : ""}`
191
+ }), c.secret && /* @__PURE__ */ i("button", {
192
+ type: "button",
193
+ onClick: () => g((e) => !e),
194
+ "aria-label": h ? `Hide ${y}` : `Show ${y}`,
195
+ className: "absolute right-2 top-2 text-text-secondary hover:text-text-primary",
196
+ children: i(h ? n : t, { size: 16 })
197
+ })]
198
+ }),
199
+ x
200
+ ] });
201
+ }
202
+ return /* @__PURE__ */ a("div", { children: [
203
+ S,
163
204
  /* @__PURE__ */ a("div", {
164
205
  className: "relative",
165
206
  children: [/* @__PURE__ */ i("input", {
166
207
  id: o,
167
- "aria-label": g,
168
- type: c.secret && !m ? "password" : "text",
208
+ "aria-label": y,
209
+ type: c.secret && !h ? "password" : "text",
169
210
  value: String(u ?? ""),
170
- onChange: (e) => p(e.target.value),
171
- placeholder: _,
172
- disabled: f,
211
+ onChange: (e) => m(e.target.value),
212
+ placeholder: b,
213
+ disabled: p,
173
214
  autoComplete: "off",
174
- className: `${b} ${c.secret ? "font-mono pr-10" : ""}`
215
+ className: `${C} ${c.secret ? "font-mono pr-10" : ""}`
175
216
  }), c.secret && /* @__PURE__ */ i("button", {
176
217
  type: "button",
177
- onClick: () => h((e) => !e),
178
- "aria-label": m ? `Hide ${g}` : `Show ${g}`,
218
+ onClick: () => g((e) => !e),
219
+ "aria-label": h ? `Hide ${y}` : `Show ${y}`,
179
220
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary",
180
- children: i(m ? n : t, { size: 16 })
221
+ children: i(h ? n : t, { size: 16 })
181
222
  })]
182
223
  }),
183
- v
224
+ x
184
225
  ] });
185
226
  };
186
227
  //#endregion
187
- export { f as SchemaForm, u as initialValuesFromSchema, c as isSchemaComplete, o as parseFormSchema, d as visibleValues };
228
+ export { p as SchemaForm, u as initialValuesFromSchema, c as isSchemaComplete, o as parseFormSchema, d as visibleValues };
188
229
 
189
230
  //# sourceMappingURL=SchemaForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaForm.js","names":[],"sources":["../../../src/integrations/components/SchemaForm.tsx"],"sourcesContent":["/**\n * SchemaForm — renders a credential form from a JSON-Schema-ish description.\n *\n * The whole point of this component is that it is the *only* place credential\n * fields are drawn. A provider (or one of its auth methods) describes what it\n * needs as data, this renders it, and adding a provider or an authentication\n * method never requires new React.\n *\n * Supported per-property keys, beyond plain JSON Schema:\n * secret -> masked input with a reveal toggle\n * format -> 'textarea' | 'json' for multi-line values (service-account keys)\n * enum -> string[] or {label,value}[] for a select\n * showIf -> { field: value | value[] } conditional visibility\n * placeholder -> distinct from `description`, which renders as help text\n * type -> 'notice' renders informational copy instead of an input\n */\nimport type { FC } from 'react';\nimport { useState } from 'react';\nimport { Eye, EyeOff, Info } from 'lucide-react';\n\nexport interface SchemaProperty {\n type?: string;\n title?: string;\n description?: string;\n placeholder?: string;\n secret?: boolean;\n format?: string;\n default?: string | number | boolean;\n enum?: Array<string | { label: string; value: string }>;\n showIf?: Record<string, unknown>;\n}\n\nexport interface FormSchema {\n type?: string;\n properties: Record<string, SchemaProperty>;\n required: string[];\n}\n\n/**\n * Narrow an arbitrary JSON value to a renderable schema. Returns null when the\n * value isn't a usable object schema, so callers can fall back rather than\n * rendering an empty form.\n */\nexport function parseFormSchema(raw: unknown): FormSchema | null {\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return null;\n const candidate = raw as { properties?: unknown; required?: unknown };\n if (typeof candidate.properties !== 'object' || candidate.properties === null) return null;\n return {\n properties: candidate.properties as Record<string, SchemaProperty>,\n required: Array.isArray(candidate.required)\n ? candidate.required.filter((r): r is string => typeof r === 'string')\n : [],\n };\n}\n\n/**\n * Evaluate a property's `showIf`. A field is visible when every named field\n * holds one of the accepted values, so dependent fields (e.g. \"custom scopes\"\n * revealed by a toggle) need no bespoke component.\n */\nfunction isVisible(property: SchemaProperty, values: Record<string, unknown>): boolean {\n if (!property.showIf) return true;\n return Object.entries(property.showIf).every(([field, expected]) => {\n const actual = values[field];\n return Array.isArray(expected) ? expected.includes(actual) : actual === expected;\n });\n}\n\n/**\n * Required fields that are visible and filled. Hidden fields are excluded on\n * purpose — a `showIf` field the user never saw must not block submission.\n */\nexport function isSchemaComplete(schema: FormSchema, values: Record<string, unknown>): boolean {\n return schema.required.every((field) => {\n const property = schema.properties[field];\n if (property && !isVisible(property, values)) return true;\n const value = values[field];\n return typeof value === 'string'\n ? value.trim().length > 0\n : value !== undefined && value !== null;\n });\n}\n\nfunction normalizeOptions(\n options: Array<string | { label: string; value: string }>\n): Array<{ label: string; value: string }> {\n return options.map((option) =>\n typeof option === 'string' ? { label: option, value: option } : option\n );\n}\n\n/**\n * Seed values for a schema's declared defaults.\n *\n * A rendered control shows `property.default` as selected, but nothing was\n * written to form state — so validation treated the visible default as missing\n * and submit dropped it unless the user touched the control. The common\n * \"accept the default\" path silently lost the value.\n */\nexport function initialValuesFromSchema(schema: FormSchema | null): Record<string, unknown> {\n if (!schema) return {};\n const values: Record<string, unknown> = {};\n for (const [field, property] of Object.entries(schema.properties)) {\n if (property.default !== undefined) values[field] = property.default;\n }\n return values;\n}\n\n/**\n * Drop values whose field is currently hidden by `showIf`.\n *\n * Changing a controlling option hides a field but leaves whatever was typed in\n * it in state; submitting that would store a credential the user can no longer\n * see and did not intend to send.\n */\nexport function visibleValues(\n schema: FormSchema | null,\n values: Record<string, unknown>\n): Record<string, unknown> {\n if (!schema) return values;\n const result: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(values)) {\n const property = schema.properties[field];\n if (property && !isVisible(property, values)) continue;\n result[field] = value;\n }\n return result;\n}\n\ninterface SchemaFormProps {\n schema: FormSchema;\n values: Record<string, unknown>;\n onChange: (values: Record<string, unknown>) => void;\n disabled?: boolean;\n /** Prefix for generated element ids so several forms can coexist on a page. */\n idPrefix?: string;\n}\n\nexport const SchemaForm: FC<SchemaFormProps> = ({\n schema,\n values,\n onChange,\n disabled,\n idPrefix = 'schema',\n}) => {\n const required = new Set(schema.required);\n\n return (\n <div className=\"space-y-3\">\n {Object.entries(schema.properties)\n .filter(([, property]) => isVisible(property, values))\n .map(([field, property]) => (\n <SchemaField\n key={field}\n id={`${idPrefix}-${field}`}\n name={field}\n property={property}\n value={values[field]}\n required={required.has(field)}\n disabled={disabled}\n onChange={(next) => onChange({ ...values, [field]: next })}\n />\n ))}\n </div>\n );\n};\n\ninterface SchemaFieldProps {\n id: string;\n name: string;\n property: SchemaProperty;\n value: unknown;\n required: boolean;\n disabled?: boolean;\n onChange: (value: unknown) => void;\n}\n\nconst SchemaField: FC<SchemaFieldProps> = ({\n id,\n name,\n property,\n value,\n required,\n disabled,\n onChange,\n}) => {\n const [revealed, setRevealed] = useState(false);\n const label = property.title ?? name;\n const placeholder = property.placeholder ?? property.description ?? '';\n\n if (property.type === 'notice') {\n return (\n <div className=\"flex items-start gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Info size={14} className=\"text-status-info-text flex-shrink-0 mt-0.5\" />\n <span className=\"text-xs text-status-info-text\">{property.description ?? label}</span>\n </div>\n );\n }\n\n const help = property.description ? (\n <p className=\"mt-1 text-xs text-text-secondary\">{property.description}</p>\n ) : null;\n\n const labelNode = (\n <label htmlFor={id} className=\"block text-sm font-medium text-text-primary mb-1.5\">\n {label} {required && <span className=\"text-status-error-text\">*</span>}\n </label>\n );\n\n const inputClass =\n 'w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50';\n\n if (property.type === 'boolean') {\n // One resolved value drives aria-checked, the visual state and the toggle.\n // Reading `value` directly for the styling while aria-checked fell back to\n // `property.default` made a defaulted-true switch render as off, and the\n // first click then set it to the value it already reported — appearing to do\n // nothing.\n const checked = Boolean(value ?? property.default ?? false);\n return (\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n role=\"switch\"\n id={id}\n aria-checked={checked}\n aria-label={label}\n onClick={() => onChange(!checked)}\n disabled={disabled}\n className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${\n checked ? 'bg-primary' : 'bg-bg-muted'\n }`}\n >\n <span\n className={`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${\n checked ? 'translate-x-4.5' : 'translate-x-0.5'\n }`}\n />\n </button>\n <span className=\"text-sm font-medium text-text-primary\">\n {label}\n {property.description && (\n <span className=\"text-text-secondary font-normal ml-1\">— {property.description}</span>\n )}\n </span>\n </div>\n );\n }\n\n if (property.enum && property.enum.length > 0) {\n return (\n <div>\n {labelNode}\n <select\n id={id}\n aria-label={label}\n value={String(value ?? property.default ?? '')}\n onChange={(event) => onChange(event.target.value)}\n disabled={disabled}\n className={inputClass}\n >\n <option value=\"\">Select {label.toLowerCase()}</option>\n {normalizeOptions(property.enum).map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n {help}\n </div>\n );\n }\n\n if (property.type === 'number') {\n return (\n <div>\n {labelNode}\n <input\n id={id}\n aria-label={label}\n type=\"number\"\n value={value === undefined || value === null ? '' : String(value)}\n onChange={(event) =>\n onChange(event.target.value === '' ? undefined : Number(event.target.value))\n }\n placeholder={placeholder}\n disabled={disabled}\n className={inputClass}\n />\n {help}\n </div>\n );\n }\n\n // Multi-line values (service-account key JSON, PEM blocks) are unusable in a\n // single-line input — the previous form made you paste a whole JSON key into\n // one, so `format` is honoured before the secret/plain split.\n const multiline = property.format === 'textarea' || property.format === 'json';\n if (multiline) {\n return (\n <div>\n {labelNode}\n <textarea\n id={id}\n aria-label={label}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n rows={5}\n autoComplete=\"off\"\n spellCheck={false}\n className={`${inputClass} font-mono`}\n />\n {help}\n </div>\n );\n }\n\n return (\n <div>\n {labelNode}\n <div className=\"relative\">\n <input\n id={id}\n aria-label={label}\n type={property.secret && !revealed ? 'password' : 'text'}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n autoComplete=\"off\"\n className={`${inputClass} ${property.secret ? 'font-mono pr-10' : ''}`}\n />\n {property.secret && (\n <button\n type=\"button\"\n onClick={() => setRevealed((previous) => !previous)}\n aria-label={revealed ? `Hide ${label}` : `Show ${label}`}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary\"\n >\n {revealed ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n )}\n </div>\n {help}\n </div>\n );\n};\n"],"mappings":";;;;AA2CA,SAAgB,EAAgB,GAAiC;AAC/D,KAAI,OAAO,KAAQ,aAAY,KAAgB,MAAM,QAAQ,EAAI,CAAE,QAAO;CAC1E,IAAM,IAAY;AAElB,QADI,OAAO,EAAU,cAAe,YAAY,EAAU,eAAe,OAAa,OAC/E;EACL,YAAY,EAAU;EACtB,UAAU,MAAM,QAAQ,EAAU,SAAS,GACvC,EAAU,SAAS,QAAQ,MAAmB,OAAO,KAAM,SAAS,GACpE,EAAE;EACP;;AAQH,SAAS,EAAU,GAA0B,GAA0C;AAErF,QADK,EAAS,SACP,OAAO,QAAQ,EAAS,OAAO,CAAC,OAAO,CAAC,GAAO,OAAc;EAClE,IAAM,IAAS,EAAO;AACtB,SAAO,MAAM,QAAQ,EAAS,GAAG,EAAS,SAAS,EAAO,GAAG,MAAW;GACxE,GAJ2B;;AAW/B,SAAgB,EAAiB,GAAoB,GAA0C;AAC7F,QAAO,EAAO,SAAS,OAAO,MAAU;EACtC,IAAM,IAAW,EAAO,WAAW;AACnC,MAAI,KAAY,CAAC,EAAU,GAAU,EAAO,CAAE,QAAO;EACrD,IAAM,IAAQ,EAAO;AACrB,SAAO,OAAO,KAAU,WACpB,EAAM,MAAM,CAAC,SAAS,IACtB,KAAiC;GACrC;;AAGJ,SAAS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,EAFI,EAAO,MAEX,CACT,CACK;;EACR;EACG,EAAA,CAAA,GAIN,EAAS,SAAS,WAElB,kBAAC,OAAD,EAAA,UAAA;EACG;EACD,kBAAC,SAAD;GACM;GACJ,cAAY;GACZ,MAAK;GACL,OAAO,KAAiC,OAAO,KAAK,OAAO,EAAM;GACjE,WAAW,MACT,EAAS,EAAM,OAAO,UAAU,KAAK,KAAA,IAAY,OAAO,EAAM,OAAO,MAAM,CAAC;GAEjE;GACH;GACV,WAAW;GACX,CAAA;EACD;EACG,EAAA,CAAA,GAOQ,EAAS,WAAW,cAAc,EAAS,WAAW,SAGpE,kBAAC,OAAD,EAAA,UAAA;EACG;EACD,kBAAC,YAAD;GACM;GACJ,cAAY;GACZ,OAAO,OAAO,KAAS,GAAG;GAC1B,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;GACpC;GACH;GACV,MAAM;GACN,cAAa;GACb,YAAY;GACZ,WAAW,GAAG,EAAW;GACzB,CAAA;EACD;EACG,EAAA,CAAA,GAKR,kBAAC,OAAD,EAAA,UAAA;EACG;EACD,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,SAAD;IACM;IACJ,cAAY;IACZ,MAAM,EAAS,UAAU,CAAC,IAAW,aAAa;IAClD,OAAO,OAAO,KAAS,GAAG;IAC1B,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;IACpC;IACH;IACV,cAAa;IACb,WAAW,GAAG,EAAW,GAAG,EAAS,SAAS,oBAAoB;IAClE,CAAA,EACD,EAAS,UACR,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,GAAa,MAAa,CAAC,EAAS;IACnD,cAAY,IAAW,QAAQ,MAAU,QAAQ;IACjD,WAAU;cAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;IAC7C,CAAA,CAEP;;EACL;EACG,EAAA,CAAA"}
1
+ {"version":3,"file":"SchemaForm.js","names":[],"sources":["../../../src/integrations/components/SchemaForm.tsx"],"sourcesContent":["/**\n * SchemaForm — renders a credential form from a JSON-Schema-ish description.\n *\n * The whole point of this component is that it is the *only* place credential\n * fields are drawn. A provider (or one of its auth methods) describes what it\n * needs as data, this renders it, and adding a provider or an authentication\n * method never requires new React.\n *\n * Supported per-property keys, beyond plain JSON Schema:\n * secret -> masked input with a reveal toggle\n * format -> 'textarea' | 'json' for multi-line values (service-account keys)\n * enum -> string[] or {label,value}[] for a select\n * showIf -> { field: value | value[] } conditional visibility\n * placeholder -> distinct from `description`, which renders as help text\n * type -> 'notice' renders informational copy instead of an input\n */\nimport type { CSSProperties, FC } from 'react';\nimport { useState } from 'react';\nimport { Eye, EyeOff, Info } from 'lucide-react';\n\nexport interface SchemaProperty {\n type?: string;\n title?: string;\n description?: string;\n placeholder?: string;\n secret?: boolean;\n format?: string;\n default?: string | number | boolean;\n enum?: Array<string | { label: string; value: string }>;\n showIf?: Record<string, unknown>;\n}\n\nexport interface FormSchema {\n type?: string;\n properties: Record<string, SchemaProperty>;\n required: string[];\n}\n\n/**\n * Narrow an arbitrary JSON value to a renderable schema. Returns null when the\n * value isn't a usable object schema, so callers can fall back rather than\n * rendering an empty form.\n */\nexport function parseFormSchema(raw: unknown): FormSchema | null {\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return null;\n const candidate = raw as { properties?: unknown; required?: unknown };\n if (typeof candidate.properties !== 'object' || candidate.properties === null) return null;\n return {\n properties: candidate.properties as Record<string, SchemaProperty>,\n required: Array.isArray(candidate.required)\n ? candidate.required.filter((r): r is string => typeof r === 'string')\n : [],\n };\n}\n\n/**\n * Evaluate a property's `showIf`. A field is visible when every named field\n * holds one of the accepted values, so dependent fields (e.g. \"custom scopes\"\n * revealed by a toggle) need no bespoke component.\n */\nfunction isVisible(property: SchemaProperty, values: Record<string, unknown>): boolean {\n if (!property.showIf) return true;\n return Object.entries(property.showIf).every(([field, expected]) => {\n const actual = values[field];\n return Array.isArray(expected) ? expected.includes(actual) : actual === expected;\n });\n}\n\n/**\n * Required fields that are visible and filled. Hidden fields are excluded on\n * purpose — a `showIf` field the user never saw must not block submission.\n */\nexport function isSchemaComplete(schema: FormSchema, values: Record<string, unknown>): boolean {\n return schema.required.every((field) => {\n const property = schema.properties[field];\n if (property && !isVisible(property, values)) return true;\n const value = values[field];\n return typeof value === 'string'\n ? value.trim().length > 0\n : value !== undefined && value !== null;\n });\n}\n\nfunction normalizeOptions(\n options: Array<string | { label: string; value: string }>\n): Array<{ label: string; value: string }> {\n return options.map((option) =>\n typeof option === 'string' ? { label: option, value: option } : option\n );\n}\n\n/**\n * Seed values for a schema's declared defaults.\n *\n * A rendered control shows `property.default` as selected, but nothing was\n * written to form state — so validation treated the visible default as missing\n * and submit dropped it unless the user touched the control. The common\n * \"accept the default\" path silently lost the value.\n */\nexport function initialValuesFromSchema(schema: FormSchema | null): Record<string, unknown> {\n if (!schema) return {};\n const values: Record<string, unknown> = {};\n const required = new Set(schema.required);\n for (const [field, property] of Object.entries(schema.properties)) {\n if (property.default !== undefined) {\n values[field] = property.default;\n continue;\n }\n // A boolean with no declared default still renders as a usable control in\n // its \"off\" position, so a *required* boolean was impossible to satisfy.\n // Required only: seeding an *optional* boolean would submit an explicit\n // false the user never chose. A required one needs the entry because its\n // rendered \"off\" position is already a valid answer.\n if (property.type === 'boolean' && required.has(field)) values[field] = false;\n }\n return values;\n}\n\n/**\n * Drop values whose field is currently hidden by `showIf`.\n *\n * Changing a controlling option hides a field but leaves whatever was typed in\n * it in state; submitting that would store a credential the user can no longer\n * see and did not intend to send.\n */\nexport function visibleValues(\n schema: FormSchema | null,\n values: Record<string, unknown>\n): Record<string, unknown> {\n if (!schema) return values;\n const result: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(values)) {\n const property = schema.properties[field];\n if (property && !isVisible(property, values)) continue;\n result[field] = value;\n }\n return result;\n}\n\n/**\n * Whether the engine can mask a textarea's rendering without altering its value.\n *\n * `-webkit-text-security` is non-standard and Firefox does not implement it, so\n * on those engines a masked textarea would silently render the secret in\n * cleartext — the exact bug this masking exists to fix. Detected once at module\n * load; consumers fall back to a reveal-to-edit control that never renders the\n * raw value at all.\n */\nconst SUPPORTS_TEXT_SECURITY =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('-webkit-text-security', 'disc');\n\ninterface SchemaFormProps {\n schema: FormSchema;\n values: Record<string, unknown>;\n onChange: (values: Record<string, unknown>) => void;\n disabled?: boolean;\n /** Prefix for generated element ids so several forms can coexist on a page. */\n idPrefix?: string;\n}\n\nexport const SchemaForm: FC<SchemaFormProps> = ({\n schema,\n values,\n onChange,\n disabled,\n idPrefix = 'schema',\n}) => {\n const required = new Set(schema.required);\n\n return (\n <div className=\"space-y-3\">\n {Object.entries(schema.properties)\n .filter(([, property]) => isVisible(property, values))\n .map(([field, property]) => (\n <SchemaField\n key={field}\n id={`${idPrefix}-${field}`}\n name={field}\n property={property}\n value={values[field]}\n required={required.has(field)}\n disabled={disabled}\n onChange={(next) => onChange({ ...values, [field]: next })}\n />\n ))}\n </div>\n );\n};\n\ninterface SchemaFieldProps {\n id: string;\n name: string;\n property: SchemaProperty;\n value: unknown;\n required: boolean;\n disabled?: boolean;\n onChange: (value: unknown) => void;\n}\n\nconst SchemaField: FC<SchemaFieldProps> = ({\n id,\n name,\n property,\n value,\n required,\n disabled,\n onChange,\n}) => {\n const [revealed, setRevealed] = useState(false);\n // Only meaningful on engines without `-webkit-text-security` (see below): the\n // field is being typed into right now, so it must stay a real textarea.\n const [editing, setEditing] = useState(false);\n const label = property.title ?? name;\n const placeholder = property.placeholder ?? property.description ?? '';\n\n if (property.type === 'notice') {\n return (\n <div className=\"flex items-start gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Info size={14} className=\"text-status-info-text flex-shrink-0 mt-0.5\" />\n <span className=\"text-xs text-status-info-text\">{property.description ?? label}</span>\n </div>\n );\n }\n\n const help = property.description ? (\n <p className=\"mt-1 text-xs text-text-secondary\">{property.description}</p>\n ) : null;\n\n const labelNode = (\n <label htmlFor={id} className=\"block text-sm font-medium text-text-primary mb-1.5\">\n {label} {required && <span className=\"text-status-error-text\">*</span>}\n </label>\n );\n\n const inputClass =\n 'w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50';\n\n if (property.type === 'boolean') {\n // One resolved value drives aria-checked, the visual state and the toggle.\n // Reading `value` directly for the styling while aria-checked fell back to\n // `property.default` made a defaulted-true switch render as off, and the\n // first click then set it to the value it already reported — appearing to do\n // nothing.\n const checked = Boolean(value ?? property.default ?? false);\n return (\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n role=\"switch\"\n id={id}\n aria-checked={checked}\n aria-label={label}\n onClick={() => onChange(!checked)}\n disabled={disabled}\n className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${\n checked ? 'bg-primary' : 'bg-bg-muted'\n }`}\n >\n <span\n className={`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${\n checked ? 'translate-x-4.5' : 'translate-x-0.5'\n }`}\n />\n </button>\n <span className=\"text-sm font-medium text-text-primary\">\n {label}\n {property.description && (\n <span className=\"text-text-secondary font-normal ml-1\">— {property.description}</span>\n )}\n </span>\n </div>\n );\n }\n\n if (property.enum && property.enum.length > 0) {\n return (\n <div>\n {labelNode}\n <select\n id={id}\n aria-label={label}\n value={String(value ?? property.default ?? '')}\n onChange={(event) => onChange(event.target.value)}\n disabled={disabled}\n className={inputClass}\n >\n <option value=\"\">Select {label.toLowerCase()}</option>\n {normalizeOptions(property.enum).map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n {help}\n </div>\n );\n }\n\n if (property.type === 'number') {\n return (\n <div>\n {labelNode}\n <input\n id={id}\n aria-label={label}\n type=\"number\"\n value={value === undefined || value === null ? '' : String(value)}\n onChange={(event) =>\n onChange(event.target.value === '' ? undefined : Number(event.target.value))\n }\n placeholder={placeholder}\n disabled={disabled}\n className={inputClass}\n />\n {help}\n </div>\n );\n }\n\n // Multi-line values (service-account key JSON, PEM blocks) are unusable in a\n // single-line input — the previous form made you paste a whole JSON key into\n // one, so `format` is honoured before the secret/plain split.\n const multiline = property.format === 'textarea' || property.format === 'json';\n if (multiline) {\n // A multi-line field can still be a secret — a service-account key JSON is\n // both `secret: true` and `format: textarea`. This branch used to return\n // before the masking code, so the private key rendered in cleartext.\n //\n // Masked with `-webkit-text-security`, the textarea equivalent of\n // `type=\"password\"` on the single-line branch: the DOM keeps the REAL\n // value, only its rendering changes. Every earlier attempt here swapped the\n // value for a mask string, and each one broke editing in a different way —\n // an empty field went read-only, then typing flipped it mid-edit, then\n // concealment keyed on mount state and so never engaged at all, because in\n // this dialog the field is always empty at mount (secrets are never read\n // back from the server). Not substituting the value avoids the whole class.\n const masked = Boolean(property.secret) && !revealed;\n const hasValue = typeof value === 'string' && value.length > 0;\n // Where the engine cannot mask rendering, never leave the value on screen:\n // show a placeholder box and require an explicit reveal to edit it.\n //\n // `editing` is what keeps this usable. Without it the box replaced the\n // textarea on the first keystroke, so a key pasted in chunks — or typed at\n // all — had to be revealed to continue. Concealment therefore waits for\n // focus to leave: while the field has focus it stays editable, and a secret\n // is only ever left drawn on a field the user is actively working in.\n const concealWithoutCss = masked && !SUPPORTS_TEXT_SECURITY && hasValue && !editing;\n\n if (concealWithoutCss) {\n return (\n <div>\n {labelNode}\n <div className=\"flex items-center justify-between gap-2 px-3 py-2 border border-border-subtle rounded-md bg-bg-surface\">\n <span className=\"text-sm font-mono text-text-secondary select-none\">••••••••••••</span>\n <button\n type=\"button\"\n onClick={() => setRevealed(true)}\n disabled={disabled}\n aria-label={`Show ${label}`}\n className=\"inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50\"\n >\n <Eye size={14} /> Reveal to edit\n </button>\n </div>\n {help}\n </div>\n );\n }\n\n return (\n <div>\n {labelNode}\n <div className=\"relative\">\n <textarea\n id={id}\n aria-label={label}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n onFocus={() => setEditing(true)}\n onBlur={() => setEditing(false)}\n placeholder={placeholder}\n disabled={disabled}\n rows={5}\n autoComplete=\"off\"\n spellCheck={false}\n // Masks what is drawn, not what is stored, so typing and paste keep\n // working and focus discloses nothing.\n // Cast: -webkit-text-security is not in React's CSSProperties, but\n // it is the only way to mask a textarea without replacing its value.\n style={masked ? ({ WebkitTextSecurity: 'disc' } as CSSProperties) : undefined}\n className={`${inputClass} font-mono ${property.secret ? 'pr-10' : ''}`}\n />\n {property.secret && (\n <button\n type=\"button\"\n onClick={() => setRevealed((previous) => !previous)}\n aria-label={revealed ? `Hide ${label}` : `Show ${label}`}\n className=\"absolute right-2 top-2 text-text-secondary hover:text-text-primary\"\n >\n {revealed ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n )}\n </div>\n {help}\n </div>\n );\n }\n\n return (\n <div>\n {labelNode}\n <div className=\"relative\">\n <input\n id={id}\n aria-label={label}\n type={property.secret && !revealed ? 'password' : 'text'}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n autoComplete=\"off\"\n className={`${inputClass} ${property.secret ? 'font-mono pr-10' : ''}`}\n />\n {property.secret && (\n <button\n type=\"button\"\n onClick={() => setRevealed((previous) => !previous)}\n aria-label={revealed ? `Hide ${label}` : `Show ${label}`}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary\"\n >\n {revealed ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n )}\n </div>\n {help}\n </div>\n );\n};\n"],"mappings":";;;;AA2CA,SAAgB,EAAgB,GAAiC;AAC/D,KAAI,OAAO,KAAQ,aAAY,KAAgB,MAAM,QAAQ,EAAI,CAAE,QAAO;CAC1E,IAAM,IAAY;AAElB,QADI,OAAO,EAAU,cAAe,YAAY,EAAU,eAAe,OAAa,OAC/E;EACL,YAAY,EAAU;EACtB,UAAU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AAW,MAAU,EAAS,EAAM,OAAO,MAAM;IACpC;IACH;IACV,cAAa;IACb,WAAW,GAAG,EAAW,GAAG,EAAS,SAAS,oBAAoB;IAClE,CAAA,EACD,EAAS,UACR,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,GAAa,MAAa,CAAC,EAAS;IACnD,cAAY,IAAW,QAAQ,MAAU,QAAQ;IACjD,WAAU;cAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;IAC7C,CAAA,CAEP;;EACL;EACG,EAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-integrations",
3
- "version": "2026.807.2",
3
+ "version": "2026.810.1",
4
4
  "description": "Burdenoff Integrations Microfrontend - Plugin-based provider and connection management interface",
5
5
  "type": "module",
6
6
  "files": [