@burdenoff/microfe-integrations 2026.929.3 → 2026.930.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/wspace-operations.d.ts +0 -137
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +73 -142
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/index.js +4 -3
- package/dist/integrations/ConnectSourceDialog.d.ts +21 -0
- package/dist/integrations/ConnectSourceDialog.d.ts.map +1 -0
- package/dist/integrations/ConnectSourceDialog.js +56 -0
- package/dist/integrations/ConnectSourceDialog.js.map +1 -0
- package/dist/integrations/ConnectionsPanel.d.ts.map +1 -1
- package/dist/integrations/ConnectionsPanel.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts +22 -11
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +54 -602
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/AuthMethodsEditor.d.ts.map +1 -1
- package/dist/integrations/components/AuthMethodsEditor.js +69 -68
- package/dist/integrations/components/AuthMethodsEditor.js.map +1 -1
- package/dist/integrations/components/ConnectionCard.js +28 -28
- package/dist/integrations/components/ConnectionCard.js.map +1 -1
- package/dist/integrations/components/ConnectionModalFrame.d.ts +38 -0
- package/dist/integrations/components/ConnectionModalFrame.d.ts.map +1 -0
- package/dist/integrations/components/ConnectionModalFrame.js +64 -0
- package/dist/integrations/components/ConnectionModalFrame.js.map +1 -0
- package/dist/integrations/components/ProviderCard.js +29 -29
- package/dist/integrations/components/ProviderCard.js.map +1 -1
- package/dist/integrations/hooks/useConnections.js +91 -102
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/hooks/useLogs.js +4 -4
- package/dist/integrations/hooks/useProviders.js +36 -36
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/pages/AddConnectionWizard.d.ts.map +1 -1
- package/dist/integrations/pages/AddConnectionWizard.js +281 -277
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +24 -24
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +7 -7
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.js +34 -34
- package/dist/integrations/pages/ProviderCatalog.js +4 -4
- package/dist/integrations/pages/ProviderDetail.js +110 -110
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/translations/en.d.ts +21 -0
- package/dist/integrations/translations/en.d.ts.map +1 -1
- package/dist/integrations/utils/appearance.d.ts +0 -3
- package/dist/integrations/utils/appearance.d.ts.map +1 -1
- package/dist/integrations/utils/appearance.js +1 -20
- package/dist/integrations/utils/appearance.js.map +1 -1
- package/dist/integrations/utils/integrationsHelpers.js +1 -4
- package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
- package/package.json +5 -3
- package/dist/integrations/assets/brands/bigconsole.js +0 -6
- package/dist/integrations/assets/brands/bigconsole.js.map +0 -1
- package/dist/integrations/assets/brands/burdenoff.js +0 -6
- package/dist/integrations/assets/brands/burdenoff.js.map +0 -1
- package/dist/integrations/components/AuthMethodSelector.d.ts +0 -30
- package/dist/integrations/components/AuthMethodSelector.d.ts.map +0 -1
- package/dist/integrations/components/AuthMethodSelector.js +0 -66
- package/dist/integrations/components/AuthMethodSelector.js.map +0 -1
- package/dist/integrations/components/CredentialStorageSelector.d.ts +0 -16
- package/dist/integrations/components/CredentialStorageSelector.d.ts.map +0 -1
- package/dist/integrations/components/CredentialStorageSelector.js +0 -262
- package/dist/integrations/components/CredentialStorageSelector.js.map +0 -1
- package/dist/integrations/components/ProviderIcon.d.ts +0 -25
- package/dist/integrations/components/ProviderIcon.d.ts.map +0 -1
- package/dist/integrations/components/ProviderIcon.js +0 -166
- package/dist/integrations/components/ProviderIcon.js.map +0 -1
- package/dist/integrations/components/SchemaForm.d.ts +0 -60
- package/dist/integrations/components/SchemaForm.d.ts.map +0 -1
- package/dist/integrations/components/SchemaForm.js +0 -235
- package/dist/integrations/components/SchemaForm.js.map +0 -1
- package/dist/integrations/hooks/useCredentialVaults.d.ts +0 -40
- package/dist/integrations/hooks/useCredentialVaults.d.ts.map +0 -1
- package/dist/integrations/hooks/useCredentialVaults.js +0 -98
- package/dist/integrations/hooks/useCredentialVaults.js.map +0 -1
- package/dist/integrations/utils/oauthPopup.d.ts +0 -16
- package/dist/integrations/utils/oauthPopup.d.ts.map +0 -1
- package/dist/integrations/utils/oauthPopup.js +0 -62
- package/dist/integrations/utils/oauthPopup.js.map +0 -1
- package/dist/node_modules/@iconify/react/dist/iconify.js +0 -1005
- package/dist/node_modules/@iconify/react/dist/iconify.js.map +0 -1
|
@@ -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 Copy,\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 { useTr } from '../hooks/useTr';\nimport { useCategoryLabel, useAuthTypeLabel } from '../hooks/useLabel';\nimport { legacyFlowForAuthType } 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 { AuthMethodNotice, 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\n/**\n * Above the app shell's header (`z-index: 100`).\n *\n * The dialog used to sit at Tailwind's `z-50`, so the shell header painted over\n * its top edge and swallowed the title and the Method control — the dialog\n * looked \"cut off\" no matter how its height was constrained. A modal must\n * out-rank the chrome it covers, and Tailwind's scale stops well below it.\n */\nconst OVERLAY_Z = 1100;\nconst DIALOG_Z = 1101;\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n onConnectionCreated,\n}: AddConnectionDialogProps) {\n // Provider data\n const tr = useTr();\n const getCategoryLabel = useCategoryLabel();\n const getAuthTypeLabel = useAuthTypeLabel();\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 [redirectCopied, setRedirectCopied] = useState(false);\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\n // The exact value the provider will compare against at the callback. Built\n // here rather than only at submit time so the dialog can show the user what\n // to register in their own OAuth app.\n const oauthCallbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\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 // True for \"Custom OAuth 2.0\" and the generic OAuth provider — the methods\n // where the user brings an app of their own and therefore needs the redirect\n // URL. Derived from the schema rather than a hardcoded method key so an\n // admin-authored method that asks for a client id gets the same help.\n const collectsOwnClientId = Boolean(\n activeSchema && Object.prototype.hasOwnProperty.call(activeSchema.properties ?? {}, 'clientId')\n );\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(\n tr(\n 'integrations.addConnection.errors.vaultRequired',\n 'Please select a vault for storing or referencing credentials'\n )\n );\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage(\n tr(\n 'integrations.addConnection.errors.secretRequired',\n 'Please select an existing vault secret to reuse'\n )\n );\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage(\n tr('integrations.addConnection.errors.fieldsRequired', 'Please fill in all required fields')\n );\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n tr(\n 'integrations.addConnection.authentication.methodNotConfigured',\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n )\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(\n tr('integrations.addConnection.errors.createFailed', 'Failed to create connection')\n );\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 result = await initiateOAuth(connId, oauthCallbackUrl, 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 tr(\n 'integrations.addConnection.authentication.popupBlocked',\n 'Popup was blocked. Please allow popups for this site and try again.'\n )\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(\n tr(\n 'integrations.addConnection.errors.fieldsRequired',\n 'Please fill in all required fields'\n )\n );\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(\n err instanceof Error\n ? err.message\n : tr('integrations.addConnection.errors.authFailed', 'Authentication failed')\n );\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 tr,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n {\n key: 'connection',\n label: tr('integrations.addConnection.tabs.connection', 'Connection'),\n icon: Link2,\n },\n { key: 'details', label: tr('integrations.addConnection.tabs.details', 'Details'), icon: Info },\n ];\n\n if (!open) return null;\n\n if (!canCreate && !permissionsLoading) {\n return (\n <>\n <div\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay 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 style={{ zIndex: DIALOG_Z }}\n className=\"fixed inset-x-4 top-1/2 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 {tr('integrations.addConnection.denied.title', 'Access Denied')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'integrations.addConnection.denied.description',\n \"You don't have permission to create connections.\"\n )}\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 {tr('integrations.common.close', 'Close')}\n </button>\n </div>\n </>\n );\n }\n\n return (\n <>\n {/* Backdrop */}\n <div\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay 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 /* `sm:` centres the dialog with `top-1/2 bottom-auto`, which leaves its\n height unbounded — a tall provider form grew past the viewport and was\n clipped at BOTH ends, taking the title and the Save button with it.\n The max-height puts the overflow back where it belongs: the scrollable\n body below. */\n style={{ zIndex: DIALOG_Z }}\n className=\"fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl 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:max-h-[min(90vh,56rem)] 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 {tr('integrations.addConnection.dialog.accountTitle', '{{provider}} account', {\n provider: selectedProvider.name,\n })}\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 {tr('integrations.addConnection.dialog.title', 'Add new credential')}\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'integrations.addConnection.dialog.subtitle',\n 'Select an app or service to connect to'\n )}\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\n ? tr('integrations.addConnection.actions.waiting', 'Waiting...')\n : /* ★ \"Connect\", not \"Save\". This dialog only ever CREATES a\n connection, and a user told to \"find the Connect button\"\n could not: the word appeared nowhere in the flow. Reported\n from production, and confirmed by driving it — the only\n action control read \"Save\".\n\n ★ A dedicated key, not `integrations.common.save`, which\n ProviderEditorPage also uses. Repurposing the shared key\n would rename that button too, and re-pointing a seeded key\n leaves already-translated locales showing the old word. */\n tr('integrations.addConnection.actions.connect', 'Connect')}\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={tr('integrations.addConnection.actions.close', 'Close dialog')}\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 {tr(\n 'integrations.addConnection.dialog.subtitle',\n 'Select an app or service to connect to'\n )}\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={tr(\n 'integrations.addConnection.search.placeholder',\n 'Search installed providers...'\n )}\n aria-label={tr(\n 'integrations.addConnection.search.ariaLabel',\n 'Search installed providers'\n )}\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={\n searchQuery\n ? tr(\n 'integrations.addConnection.empty.noMatchingProviders',\n 'No matching providers'\n )\n : tr(\n 'integrations.addConnection.empty.noInstalledProviders',\n 'No installed providers yet'\n )\n }\n description={\n searchQuery\n ? tr(\n 'integrations.addConnection.empty.matchingDescription',\n 'No installed provider matches your search. Try a different term or install one from the catalog.',\n { query: searchQuery }\n )\n : tr(\n 'integrations.addConnection.empty.installedDescription',\n 'You need at least one installed, enabled provider before you can create a connection. Install one from the catalog to get started.'\n )\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\">\n {tr(\n 'integrations.addConnection.providerUnavailable',\n \"This provider isn't available.\"\n )}\n </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\">\n {tr('integrations.addConnection.success.title', 'Connection Created!')}\n </h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n {tr(\n 'integrations.addConnection.success.description',\n 'Your {{provider}} connection has been set up successfully.',\n { provider: selectedProvider.name }\n )}\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 {tr('integrations.addConnection.actions.close', '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 {tr('integrations.addConnection.fields.connectionName', 'Connection Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label={tr(\n 'integrations.addConnection.fields.connectionName',\n 'Connection Name'\n )}\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={tr(\n 'integrations.addConnection.fields.connectionNamePlaceholder',\n 'e.g., My {{provider}} Connection',\n { provider: selectedProvider.name }\n )}\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 {tr('integrations.addConnection.fields.description', 'Description')}\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label={tr(\n 'integrations.addConnection.fields.description',\n 'Description'\n )}\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder={tr(\n 'integrations.addConnection.fields.descriptionPlaceholder',\n 'Optional description...'\n )}\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 {/* The method sits on the heading row, right-aligned —\n it decides what every field below it is, so it belongs\n with the section title rather than among the fields it\n governs. Single-method providers show the method's\n name here instead, since there is nothing to choose. */}\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"font-medium text-text-primary flex items-center gap-2 text-sm\">\n <Shield size={16} className=\"text-primary\" />\n {tr('integrations.addConnection.authentication.title', 'Authentication')}\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n ·{' '}\n {selectedAuthMethod?.displayName ??\n getAuthTypeLabel(selectedProvider.authType)}\n </span>\n )}\n </h3>\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 compact\n />\n </div>\n\n {/* What the chosen method means, kept beside the fields\n it governs. */}\n <div className=\"space-y-2\">\n <AuthMethodNotice method={selectedAuthMethod} />\n </div>\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 {/* A user supplying their own OAuth app has to\n register this exact URL in it, or the provider\n rejects the handshake with a redirect_uri\n mismatch — the single most common way a\n bring-your-own-app setup fails. Shown only for\n methods that ask for a client id, since it is\n noise for the managed ones. */}\n {collectsOwnClientId && (\n <div className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 space-y-1.5\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"text-xs font-medium text-text-primary\">\n {tr(\n 'integrations.addConnection.authentication.redirectUriLabel',\n 'Redirect URL to register in your app'\n )}\n </span>\n <button\n type=\"button\"\n onClick={() => {\n void navigator.clipboard?.writeText(oauthCallbackUrl);\n setRedirectCopied(true);\n window.setTimeout(() => setRedirectCopied(false), 2000);\n }}\n className=\"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline\"\n >\n <Copy size={12} />\n {redirectCopied\n ? tr(\n 'integrations.addConnection.authentication.copied',\n 'Copied'\n )\n : tr('integrations.addConnection.authentication.copy', 'Copy')}\n </button>\n </div>\n <code className=\"block break-all text-xs text-text-secondary\">\n {oauthCallbackUrl}\n </code>\n </div>\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 {tr(\n 'integrations.addConnection.authentication.oauthPopupInfo',\n 'A popup window will open for {{provider}} sign-in',\n { provider: selectedProvider.name }\n )}\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 {tr(\n 'integrations.addConnection.authentication.serviceAccount.description',\n 'No credentials to enter — access is granted on your behalf and tokens are issued per use.',\n { provider: selectedProvider.name }\n )}\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'integrations.addConnection.authentication.secretsEncrypted',\n 'Secret values are stored encrypted and never shown again.'\n )}\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 {tr(\n 'integrations.addConnection.authentication.noForm',\n 'This authentication method does not declare a configuration form.'\n )}\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\">\n {tr('integrations.addConnection.tabs.details', 'Details')}\n </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)} ·{' '}\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 {tr('integrations.addConnection.fields.description', '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 {tr('integrations.providerDetail.sections.website', '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 {tr(\n 'integrations.providerDetail.sections.documentation',\n 'Documentation'\n )}\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":";;;;;;;;;;;;;;;;;;;;AAsFA,IAAM,KAAY,MACZ,KAAW;AAEjB,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,0BAC2B;CAE3B,IAAM,IAAK,GAAO,EACZ,KAAmB,IAAkB,EACrC,IAAmB,IAAkB,EACrC,EAAE,qBAAkB,GAAiB,EACrC,EAAE,cAAW,SAAS,MAAqB,IAAc,EAIzD,KAAiB,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,KAAiB,IAAwB,GACzF,EACK,IAA8B,MAAkB,IAGhD,KACJ,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,SAAS,OAC/C,IAAmC,EAC/B,CAAC,MAAmB,GAA0B,EAAE,aAAa,gBAAgB,CAAC,EAG9E,CAAC,GAAkB,KAAuB,EAAqC,KAAK,EACpF,CAAC,GAAY,KAAiB,EAAS,CAAC,EAAsB,EAC9D,CAAC,GAAW,MAAgB,EAAoB,aAAa,EAC7D,CAAC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V,EAAiB;UAChB,CAAA,EACJ,kBAAC,KAAD;UAAG,WAAU;oBAAb;WACG,EAAiB,EAAiB,SAAS;WAAC;WAAU;WACtD,GAAiB,EAAiB,SAAS;WAC1C;YACA,EAAA,CAAA,CACF;;QACL,EAAiB,eAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBACZ,EAAG,iDAAiD,cAAc;SAC/D,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;mBACZ,EAAG,gDAAgD,UAAU;SAC1D,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;mBACZ,EACC,sDACA,gBACD;SACG,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,GArmBa"}
|
|
1
|
+
{"version":3,"file":"AddConnectionDialog.js","names":[],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog — \"Add a connection\" for the integrations screens.\n *\n * The dialog is `@burdenoff/fe-libs/connections`' ConnectionDialog, the same\n * one the workflow builder uses for a node's \"New connection\" (BOFF-8174). The\n * two used to be separate implementations and drifted: provider icons\n * (BOFF-8135), Custom OAuth 2.0 credentials and the redirect URL to register\n * (BOFF-8170). This component only supplies what the integrations screens know\n * and the shared dialog cannot: the shell's Apollo client, the gateway's OAuth\n * callback, the translator, this user's permissions, and this module's event\n * bus.\n *\n * Integrations-specific choices:\n * - the picker lists the workspace's installed, enabled providers;\n * - a vault is required, and the dialog offers to create one when allowed;\n * - the host's connection lists refresh after a create.\n */\nimport { useCallback, type ReactNode } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport {\n ConnectionDialog,\n type ConnectionDialogEvent,\n type ConnectionDialogPresentation,\n type CreatedConnection,\n} from '@burdenoff/fe-libs/connections';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { useTr } from '../hooks/useTr';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\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 /** Pre-selected provider key, for links that know a provider by key. */\n preselectedProviderKey?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n /**\n * `dialog` (default): a centred dialog from `sm`. `sheet`: a bottom sheet\n * below `md`, centred from `md` — what `ConnectSourceDialog` uses.\n */\n presentation?: ConnectionDialogPresentation;\n /** Heading while the provider picker shows. Defaults to \"Add new credential\". */\n pickerTitle?: string;\n /**\n * Settings stored on the new connection, e.g. the Botlit channel to return\n * to once OAuth completes.\n */\n extraConfig?: Record<string, unknown>;\n /** Replaces the success panel's button, e.g. \"Link to bot channel\". */\n renderSuccessAction?: (connection: CreatedConnection) => ReactNode;\n}\n\n/** The OAuth callback the gateway serves; providers compare it exactly. */\nexport function oauthCallbackUrl(apiGatewayUrl: string | null | undefined): string {\n return apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n}\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n preselectedProviderKey,\n onConnectionCreated,\n presentation = 'dialog',\n pickerTitle,\n extraConfig,\n renderSuccessAction,\n}: AddConnectionDialogProps) {\n const tr = useTr();\n const client = useApolloClient();\n const { apiGatewayUrl } = useIntegrations();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const emit = useIntegrationsEventBus((state) => state.emit);\n\n // While permissions load, show the form rather than flashing \"denied\"; the\n // gateway still enforces the grant on create.\n const canCreate = permissionsLoading || hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n // Vaults belong to the security module: creating a connection does not imply\n // being allowed to create one, and offering it would be a button that fails.\n const canCreateVault = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.VAULT_CREATE);\n\n const handleEvent = useCallback(\n (event: ConnectionDialogEvent) => {\n switch (event.type) {\n case 'connection-created':\n emit('integrations:connection-created', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n });\n break;\n case 'oauth-started':\n emit('integrations:oauth-started', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n });\n break;\n case 'oauth-failed':\n emit('integrations:oauth-failed', {\n connectionId: event.connectionId,\n providerKey: event.providerKey,\n error: event.error,\n });\n break;\n }\n },\n [emit]\n );\n\n const handleCreated = useCallback(\n (connection: CreatedConnection) => onConnectionCreated?.(connection.id),\n [onConnectionCreated]\n );\n\n return (\n <ConnectionDialog\n open={open}\n onClose={onClose}\n client={client}\n callbackUrl={oauthCallbackUrl(apiGatewayUrl)}\n translate={tr}\n providerId={preselectedProviderId ?? null}\n providerKey={preselectedProviderKey ?? null}\n providerSource=\"installed\"\n requireVault\n canCreate={canCreate}\n canCreateVault={canCreateVault}\n extraConfig={extraConfig}\n refetchQueriesOnCreate={['GetConnections']}\n presentation={presentation}\n pickerTitle={pickerTitle}\n renderSuccessAction={renderSuccessAction}\n onConnectionCreated={handleCreated}\n onEvent={handleEvent}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AA4DA,SAAgB,EAAiB,GAAkD;AACjF,QAAO,IACH,GAAG,EAAc,gCACjB;;AAGN,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,2BACA,wBACA,kBAAe,UACf,gBACA,gBACA,0BAC2B;CAC3B,IAAM,IAAK,GAAO,EACZ,IAAS,GAAiB,EAC1B,EAAE,qBAAkB,GAAiB,EACrC,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,IAAO,GAAyB,MAAU,EAAM,KAAK,EAIrD,IAAY,KAAsB,EAAc,EAAwB,kBAAkB,EAG1F,IAAiB,CAAC,KAAsB,EAAc,EAAwB,aAAa,EAE3F,IAAc,GACjB,MAAiC;AAChC,UAAQ,EAAM,MAAd;GACE,KAAK;AACH,MAAK,mCAAmC;KACtC,cAAc,EAAM;KACpB,aAAa,EAAM;KACpB,CAAC;AACF;GACF,KAAK;AACH,MAAK,8BAA8B;KACjC,cAAc,EAAM;KACpB,aAAa,EAAM;KACpB,CAAC;AACF;GACF,KAAK;AACH,MAAK,6BAA6B;KAChC,cAAc,EAAM;KACpB,aAAa,EAAM;KACnB,OAAO,EAAM;KACd,CAAC;AACF;;IAGN,CAAC,EAAK,CACP,EAEK,IAAgB,GACnB,MAAkC,IAAsB,EAAW,GAAG,EACvE,CAAC,EAAoB,CACtB;AAED,QACE,kBAAC,GAAD;EACQ;EACG;EACD;EACR,aAAa,EAAiB,EAAc;EAC5C,WAAW;EACX,YAAY,KAAyB;EACrC,aAAa,KAA0B;EACvC,gBAAe;EACf,cAAA;EACW;EACK;EACH;EACb,wBAAwB,CAAC,iBAAiB;EAC5B;EACD;EACQ;EACrB,qBAAqB;EACrB,SAAS;EACT,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthMethodsEditor.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AuthMethodsEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsD3E,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"AuthMethodsEditor.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AuthMethodsEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAsD3E,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA4XxD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useTr as e } from "../hooks/useTr.js";
|
|
2
2
|
import { useDeleteAuthMethod as t, useUpsertAuthMethod as n } from "../hooks/useProviders.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useId as r, useState as i } from "react";
|
|
4
|
+
import { AlertCircle as a, Check as o, Loader2 as s, Plus as c, Star as l, Trash2 as u, X as d } from "lucide-react";
|
|
5
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
|
+
import { Button as m } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
import { SchemaForm as h, parseFormSchema as g } from "@burdenoff/fe-libs/credentials";
|
|
8
8
|
//#region src/integrations/components/AuthMethodsEditor.tsx
|
|
9
9
|
var _ = [
|
|
10
10
|
"OAUTH2",
|
|
@@ -44,7 +44,7 @@ var b = {
|
|
|
44
44
|
isEnabled: !0,
|
|
45
45
|
displayOrder: "0"
|
|
46
46
|
}, x = ({ provider: x, canManage: E }) => {
|
|
47
|
-
let D = e(), { upsertAuthMethod: O, loading: k } = n(), { deleteAuthMethod: A, loading: j } = t(), [M, N] =
|
|
47
|
+
let D = e(), { upsertAuthMethod: O, loading: k } = n(), { deleteAuthMethod: A, loading: j } = t(), [M, N] = i(null), [P, F] = i(""), I = r(), L = (e) => `${I}-${e}`, R = x.authMethods ?? [], z = k || j, B = M ? g(w(M.configSchema)) : null, V = async () => {
|
|
48
48
|
if (!M) return;
|
|
49
49
|
if (F(""), !M.key.trim() || !M.displayName.trim()) {
|
|
50
50
|
F(D("integrations.providerEditor.errors.keyAndNameRequired", "Key and display name are required"));
|
|
@@ -84,73 +84,73 @@ var b = {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ p("div", {
|
|
88
88
|
className: "space-y-4",
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ p("div", {
|
|
91
91
|
className: "flex items-start justify-between gap-4",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h3", {
|
|
93
93
|
className: "text-sm font-semibold text-text-primary",
|
|
94
94
|
children: D("integrations.providerEditor.sections.authMethods", "Authentication Methods")
|
|
95
|
-
}), /* @__PURE__ */
|
|
95
|
+
}), /* @__PURE__ */ f("p", {
|
|
96
96
|
className: "text-xs text-text-secondary mt-1",
|
|
97
97
|
children: D("integrations.providerEditor.sections.authMethodsDescription", "Ways users can authenticate against this provider. When more than one is enabled, the connection form shows a dropdown. Fields come from each method's schema.")
|
|
98
|
-
})] }), E && !M && /* @__PURE__ */
|
|
98
|
+
})] }), E && !M && /* @__PURE__ */ p(m, {
|
|
99
99
|
variant: "outline",
|
|
100
100
|
size: "sm",
|
|
101
101
|
onClick: () => N({ ...b }),
|
|
102
102
|
children: [
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ f(c, { size: 14 }),
|
|
104
104
|
" ",
|
|
105
105
|
D("integrations.providerEditor.authMethods.add", "Add method")
|
|
106
106
|
]
|
|
107
107
|
})]
|
|
108
108
|
}),
|
|
109
|
-
P && /* @__PURE__ */
|
|
109
|
+
P && /* @__PURE__ */ p("div", {
|
|
110
110
|
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
111
|
+
children: [/* @__PURE__ */ f(a, {
|
|
112
112
|
size: 16,
|
|
113
113
|
className: "text-status-error-text flex-shrink-0"
|
|
114
|
-
}), /* @__PURE__ */
|
|
114
|
+
}), /* @__PURE__ */ f("span", {
|
|
115
115
|
className: "text-sm text-status-error-text",
|
|
116
116
|
children: P
|
|
117
117
|
})]
|
|
118
118
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ p("div", {
|
|
120
120
|
className: "space-y-2",
|
|
121
|
-
children: [R.length === 0 && /* @__PURE__ */
|
|
121
|
+
children: [R.length === 0 && /* @__PURE__ */ f("p", {
|
|
122
122
|
className: "text-sm text-text-secondary",
|
|
123
123
|
children: D("integrations.providerEditor.authMethods.none", "No authentication methods defined yet.")
|
|
124
|
-
}), R.map((e) => /* @__PURE__ */
|
|
124
|
+
}), R.map((e) => /* @__PURE__ */ p("div", {
|
|
125
125
|
className: "flex items-center gap-3 p-3 rounded-md border border-border-subtle",
|
|
126
|
-
children: [/* @__PURE__ */
|
|
126
|
+
children: [/* @__PURE__ */ p("div", {
|
|
127
127
|
className: "flex-1 min-w-0",
|
|
128
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ p("div", {
|
|
129
129
|
className: "flex items-center gap-2",
|
|
130
130
|
children: [
|
|
131
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ f("span", {
|
|
132
132
|
className: "text-sm font-medium text-text-primary truncate",
|
|
133
133
|
children: e.displayName
|
|
134
134
|
}),
|
|
135
|
-
e.isDefault && /* @__PURE__ */
|
|
135
|
+
e.isDefault && /* @__PURE__ */ p("span", {
|
|
136
136
|
title: D("integrations.providerEditor.authMethods.defaultMethod", "Default method"),
|
|
137
137
|
className: "inline-flex items-center gap-1 text-xs text-text-secondary",
|
|
138
138
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ f(l, { size: 12 }),
|
|
140
140
|
" ",
|
|
141
141
|
D("integrations.providerEditor.authMethods.default", "default")
|
|
142
142
|
]
|
|
143
143
|
}),
|
|
144
|
-
!e.isEnabled && /* @__PURE__ */
|
|
144
|
+
!e.isEnabled && /* @__PURE__ */ f("span", {
|
|
145
145
|
className: "text-xs text-text-secondary",
|
|
146
146
|
children: D("integrations.providerEditor.authMethods.disabled", "disabled")
|
|
147
147
|
}),
|
|
148
|
-
!e.isConfigured && /* @__PURE__ */
|
|
148
|
+
!e.isConfigured && /* @__PURE__ */ f("span", {
|
|
149
149
|
className: "text-xs text-status-warning-text",
|
|
150
150
|
children: D("integrations.providerEditor.authMethods.notConfigured", "not configured")
|
|
151
151
|
})
|
|
152
152
|
]
|
|
153
|
-
}), /* @__PURE__ */
|
|
153
|
+
}), /* @__PURE__ */ p("div", {
|
|
154
154
|
className: "text-xs text-text-secondary mt-0.5",
|
|
155
155
|
children: [
|
|
156
156
|
e.key,
|
|
@@ -160,35 +160,35 @@ var b = {
|
|
|
160
160
|
e.flow
|
|
161
161
|
]
|
|
162
162
|
})]
|
|
163
|
-
}), E && /* @__PURE__ */
|
|
163
|
+
}), E && /* @__PURE__ */ p("div", {
|
|
164
164
|
className: "flex items-center gap-1",
|
|
165
|
-
children: [/* @__PURE__ */ m
|
|
165
|
+
children: [/* @__PURE__ */ f(m, {
|
|
166
166
|
variant: "ghost",
|
|
167
167
|
size: "sm",
|
|
168
168
|
onClick: () => N(y(e)),
|
|
169
169
|
children: D("integrations.providerEditor.authMethods.edit", "Edit")
|
|
170
|
-
}), /* @__PURE__ */ m
|
|
170
|
+
}), /* @__PURE__ */ f(m, {
|
|
171
171
|
variant: "ghost",
|
|
172
172
|
size: "sm",
|
|
173
173
|
"aria-label": D("integrations.providerEditor.authMethods.removeAriaLabel", "Remove {{name}}", { name: e.displayName }),
|
|
174
174
|
onClick: () => H(e.key),
|
|
175
175
|
disabled: z,
|
|
176
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ f(u, { size: 14 })
|
|
177
177
|
})]
|
|
178
178
|
})]
|
|
179
179
|
}, e.key))]
|
|
180
180
|
}),
|
|
181
|
-
M && /* @__PURE__ */
|
|
181
|
+
M && /* @__PURE__ */ p("div", {
|
|
182
182
|
className: "rounded-md border border-border-subtle p-4 space-y-3",
|
|
183
183
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ p("div", {
|
|
185
185
|
className: "grid grid-cols-1 md:grid-cols-2 gap-3",
|
|
186
186
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ f(T, {
|
|
188
188
|
label: D("integrations.providerEditor.authMethods.key", "Key"),
|
|
189
189
|
id: L("key"),
|
|
190
190
|
required: !0,
|
|
191
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ f("input", {
|
|
192
192
|
id: L("key"),
|
|
193
193
|
"aria-label": D("integrations.providerEditor.authMethods.key", "Key"),
|
|
194
194
|
value: M.key,
|
|
@@ -200,11 +200,11 @@ var b = {
|
|
|
200
200
|
className: S
|
|
201
201
|
})
|
|
202
202
|
}),
|
|
203
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ f(T, {
|
|
204
204
|
label: D("integrations.providerEditor.authMethods.displayName", "Display name"),
|
|
205
205
|
id: L("displayName"),
|
|
206
206
|
required: !0,
|
|
207
|
-
children: /* @__PURE__ */
|
|
207
|
+
children: /* @__PURE__ */ f("input", {
|
|
208
208
|
id: L("displayName"),
|
|
209
209
|
"aria-label": D("integrations.providerEditor.authMethods.displayName", "Display name"),
|
|
210
210
|
value: M.displayName,
|
|
@@ -216,10 +216,10 @@ var b = {
|
|
|
216
216
|
className: S
|
|
217
217
|
})
|
|
218
218
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ f(T, {
|
|
220
220
|
label: D("integrations.providerEditor.authMethods.authType", "Auth type"),
|
|
221
221
|
id: L("authType"),
|
|
222
|
-
children: /* @__PURE__ */
|
|
222
|
+
children: /* @__PURE__ */ f("select", {
|
|
223
223
|
id: L("authType"),
|
|
224
224
|
"aria-label": D("integrations.providerEditor.authMethods.authType", "Auth type"),
|
|
225
225
|
value: M.authType,
|
|
@@ -228,16 +228,16 @@ var b = {
|
|
|
228
228
|
authType: e.target.value
|
|
229
229
|
}),
|
|
230
230
|
className: S,
|
|
231
|
-
children: _.map((e) => /* @__PURE__ */
|
|
231
|
+
children: _.map((e) => /* @__PURE__ */ f("option", {
|
|
232
232
|
value: e,
|
|
233
233
|
children: e
|
|
234
234
|
}, e))
|
|
235
235
|
})
|
|
236
236
|
}),
|
|
237
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ f(T, {
|
|
238
238
|
label: D("integrations.providerEditor.authMethods.flow", "Flow"),
|
|
239
239
|
id: L("flow"),
|
|
240
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ f("select", {
|
|
241
241
|
id: L("flow"),
|
|
242
242
|
"aria-label": D("integrations.providerEditor.authMethods.flow", "Flow"),
|
|
243
243
|
value: M.flow,
|
|
@@ -246,7 +246,7 @@ var b = {
|
|
|
246
246
|
flow: e.target.value
|
|
247
247
|
}),
|
|
248
248
|
className: S,
|
|
249
|
-
children: v.map((e) => /* @__PURE__ */
|
|
249
|
+
children: v.map((e) => /* @__PURE__ */ f("option", {
|
|
250
250
|
value: e,
|
|
251
251
|
children: e
|
|
252
252
|
}, e))
|
|
@@ -254,10 +254,10 @@ var b = {
|
|
|
254
254
|
})
|
|
255
255
|
]
|
|
256
256
|
}),
|
|
257
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ f(T, {
|
|
258
258
|
label: D("integrations.providerEditor.fields.description", "Description"),
|
|
259
259
|
id: L("description"),
|
|
260
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ f("input", {
|
|
261
261
|
id: L("description"),
|
|
262
262
|
"aria-label": D("integrations.providerEditor.fields.description", "Description"),
|
|
263
263
|
value: M.description,
|
|
@@ -268,12 +268,12 @@ var b = {
|
|
|
268
268
|
className: S
|
|
269
269
|
})
|
|
270
270
|
}),
|
|
271
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ p("div", {
|
|
272
272
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
273
|
-
children: [/* @__PURE__ */
|
|
273
|
+
children: [/* @__PURE__ */ f(T, {
|
|
274
274
|
label: D("integrations.providerEditor.authMethods.configSchema", "Field schema (JSON)"),
|
|
275
275
|
id: L("configSchema"),
|
|
276
|
-
children: /* @__PURE__ */
|
|
276
|
+
children: /* @__PURE__ */ f("textarea", {
|
|
277
277
|
id: L("configSchema"),
|
|
278
278
|
"aria-label": D("integrations.providerEditor.authMethods.configSchema", "Field schema (JSON)"),
|
|
279
279
|
value: M.configSchema,
|
|
@@ -286,29 +286,30 @@ var b = {
|
|
|
286
286
|
placeholder: C,
|
|
287
287
|
className: `${S} font-mono text-xs`
|
|
288
288
|
})
|
|
289
|
-
}), /* @__PURE__ */
|
|
289
|
+
}), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("span", {
|
|
290
290
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
291
291
|
children: D("integrations.providerEditor.authMethods.livePreview", "Live preview")
|
|
292
|
-
}), /* @__PURE__ */
|
|
292
|
+
}), /* @__PURE__ */ f("div", {
|
|
293
293
|
className: "rounded-md border border-border-subtle p-3 bg-bg-surface min-h-[200px]",
|
|
294
|
-
children: B ? /* @__PURE__ */
|
|
294
|
+
children: B ? /* @__PURE__ */ f(h, {
|
|
295
295
|
schema: B,
|
|
296
296
|
values: {},
|
|
297
297
|
onChange: () => void 0,
|
|
298
298
|
disabled: !0,
|
|
299
|
-
idPrefix: L("preview")
|
|
300
|
-
|
|
299
|
+
idPrefix: L("preview"),
|
|
300
|
+
translate: D
|
|
301
|
+
}) : /* @__PURE__ */ f("p", {
|
|
301
302
|
className: "text-xs text-text-secondary",
|
|
302
303
|
children: M.configSchema.trim() ? D("integrations.providerEditor.authMethods.previewInvalid", "Not a valid object schema yet.") : D("integrations.providerEditor.authMethods.previewEmpty", "Describe fields on the left to preview the form users will see.")
|
|
303
304
|
})
|
|
304
305
|
})] })]
|
|
305
306
|
}),
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ p("div", {
|
|
307
308
|
className: "flex flex-wrap items-center gap-4",
|
|
308
309
|
children: [
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ p("label", {
|
|
310
311
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
311
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ f("input", {
|
|
312
313
|
type: "checkbox",
|
|
313
314
|
"aria-label": D("integrations.providerEditor.authMethods.defaultMethod", "Default method"),
|
|
314
315
|
checked: M.isDefault,
|
|
@@ -318,9 +319,9 @@ var b = {
|
|
|
318
319
|
})
|
|
319
320
|
}), D("integrations.providerEditor.authMethods.defaultMethod", "Default method")]
|
|
320
321
|
}),
|
|
321
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ p("label", {
|
|
322
323
|
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
323
|
-
children: [/* @__PURE__ */
|
|
324
|
+
children: [/* @__PURE__ */ f("input", {
|
|
324
325
|
type: "checkbox",
|
|
325
326
|
"aria-label": D("integrations.providerEditor.authMethods.enabled", "Enabled"),
|
|
326
327
|
checked: M.isEnabled,
|
|
@@ -330,11 +331,11 @@ var b = {
|
|
|
330
331
|
})
|
|
331
332
|
}), D("integrations.providerEditor.authMethods.enabled", "Enabled")]
|
|
332
333
|
}),
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ f(T, {
|
|
334
335
|
label: D("integrations.providerEditor.authMethods.order", "Order"),
|
|
335
336
|
id: L("displayOrder"),
|
|
336
337
|
inline: !0,
|
|
337
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ f("input", {
|
|
338
339
|
id: L("displayOrder"),
|
|
339
340
|
"aria-label": D("integrations.providerEditor.authMethods.order", "Order"),
|
|
340
341
|
type: "number",
|
|
@@ -348,25 +349,25 @@ var b = {
|
|
|
348
349
|
})
|
|
349
350
|
]
|
|
350
351
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ p("div", {
|
|
352
353
|
className: "flex items-center gap-2",
|
|
353
|
-
children: [/* @__PURE__ */
|
|
354
|
+
children: [/* @__PURE__ */ p(m, {
|
|
354
355
|
onClick: V,
|
|
355
356
|
disabled: z,
|
|
356
357
|
children: [
|
|
357
|
-
z ? /* @__PURE__ */
|
|
358
|
+
z ? /* @__PURE__ */ f(s, {
|
|
358
359
|
size: 14,
|
|
359
360
|
className: "animate-spin"
|
|
360
|
-
}) : /* @__PURE__ */
|
|
361
|
+
}) : /* @__PURE__ */ f(o, { size: 14 }),
|
|
361
362
|
" ",
|
|
362
363
|
D("integrations.providerEditor.authMethods.save", "Save method")
|
|
363
364
|
]
|
|
364
|
-
}), /* @__PURE__ */
|
|
365
|
+
}), /* @__PURE__ */ p(m, {
|
|
365
366
|
variant: "outline",
|
|
366
367
|
onClick: () => N(null),
|
|
367
368
|
disabled: z,
|
|
368
369
|
children: [
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ f(d, { size: 14 }),
|
|
370
371
|
" ",
|
|
371
372
|
D("integrations.common.cancel", "Cancel")
|
|
372
373
|
]
|
|
@@ -386,15 +387,15 @@ function w(e) {
|
|
|
386
387
|
return null;
|
|
387
388
|
}
|
|
388
389
|
}
|
|
389
|
-
var T = ({ label: e, id: t, required: n, inline: r, children: i }) => /* @__PURE__ */
|
|
390
|
+
var T = ({ label: e, id: t, required: n, inline: r, children: i }) => /* @__PURE__ */ p("div", {
|
|
390
391
|
className: r ? "flex items-center gap-2" : void 0,
|
|
391
|
-
children: [/* @__PURE__ */
|
|
392
|
+
children: [/* @__PURE__ */ p("label", {
|
|
392
393
|
htmlFor: t,
|
|
393
394
|
className: r ? "text-sm font-medium text-text-primary" : "block text-sm font-medium text-text-primary mb-1.5",
|
|
394
395
|
children: [
|
|
395
396
|
e,
|
|
396
397
|
" ",
|
|
397
|
-
n && /* @__PURE__ */
|
|
398
|
+
n && /* @__PURE__ */ f("span", {
|
|
398
399
|
className: "text-status-error-text",
|
|
399
400
|
children: "*"
|
|
400
401
|
})
|