@burdenoff/microfe-integrations 2026.525.2 → 2026.527.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.
- package/dist/integrations/IntegrationsAdminRoutes.js +4 -3
- package/dist/integrations/IntegrationsAdminRoutes.js.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.js +4 -3
- package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +7 -4
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/ProviderCard.js +2 -0
- package/dist/integrations/components/ProviderCard.js.map +1 -1
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/hooks/useLogs.js.map +1 -1
- package/dist/integrations/hooks/useProviders.js.map +1 -1
- package/dist/integrations/pages/AddConnectionWizard.js +14 -2
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +8 -1
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionLogs.js +9 -1
- package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +11 -2
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.js +11 -5
- package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
- package/dist/integrations/pages/IntegrationsSettings.js +6 -2
- package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
- package/dist/integrations/pages/ProviderCatalog.js +9 -2
- package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.js +13 -2
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/pages/ProviderEditorPage.js +174 -172
- package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
- package/dist/integrations/providers/IntegrationsProvider.js +1 -1
- package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
- package/dist/integrations/utils/constants.js.map +1 -1
- package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
- package/package.json +1 -1
- package/dist/dev/main.d.ts +0 -2
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/generated/global-operations.d.ts +0 -2
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts +0 -23527
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts +0 -1645
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts +0 -57851
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/integrations/IntegrationsAdminRoot.d.ts +0 -19
- package/dist/integrations/IntegrationsAdminRoot.d.ts.map +0 -1
- package/dist/integrations/IntegrationsAdminRoutes.d.ts +0 -8
- package/dist/integrations/IntegrationsAdminRoutes.d.ts.map +0 -1
- package/dist/integrations/IntegrationsRoot.d.ts +0 -33
- package/dist/integrations/IntegrationsRoot.d.ts.map +0 -1
- package/dist/integrations/IntegrationsRoutes.d.ts +0 -17
- package/dist/integrations/IntegrationsRoutes.d.ts.map +0 -1
- package/dist/integrations/IntegrationsUserRoutes.d.ts +0 -8
- package/dist/integrations/IntegrationsUserRoutes.d.ts.map +0 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts +0 -22
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +0 -1
- package/dist/integrations/components/ConfirmDialog.d.ts +0 -17
- package/dist/integrations/components/ConfirmDialog.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionCard.d.ts +0 -14
- package/dist/integrations/components/ConnectionCard.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionStatusBadge.d.ts +0 -14
- package/dist/integrations/components/ConnectionStatusBadge.d.ts.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/ProviderCard.d.ts +0 -16
- package/dist/integrations/components/ProviderCard.d.ts.map +0 -1
- package/dist/integrations/components/ProviderIcon.d.ts +0 -19
- package/dist/integrations/components/ProviderIcon.d.ts.map +0 -1
- package/dist/integrations/components/ui.d.ts +0 -6
- package/dist/integrations/components/ui.d.ts.map +0 -1
- package/dist/integrations/constants/enums.d.ts +0 -70
- package/dist/integrations/constants/enums.d.ts.map +0 -1
- package/dist/integrations/constants/featureFlags.d.ts +0 -7
- package/dist/integrations/constants/featureFlags.d.ts.map +0 -1
- package/dist/integrations/constants/permissions.d.ts +0 -22
- package/dist/integrations/constants/permissions.d.ts.map +0 -1
- package/dist/integrations/events/integrations-events.d.ts +0 -36
- package/dist/integrations/events/integrations-events.d.ts.map +0 -1
- package/dist/integrations/events/useIntegrationsEventBus.d.ts +0 -11
- package/dist/integrations/events/useIntegrationsEventBus.d.ts.map +0 -1
- package/dist/integrations/hooks/useConnections.d.ts +0 -84
- package/dist/integrations/hooks/useConnections.d.ts.map +0 -1
- package/dist/integrations/hooks/useCredentialVaults.d.ts +0 -15
- package/dist/integrations/hooks/useCredentialVaults.d.ts.map +0 -1
- package/dist/integrations/hooks/useLogs.d.ts +0 -27
- package/dist/integrations/hooks/useLogs.d.ts.map +0 -1
- package/dist/integrations/hooks/useProviders.d.ts +0 -97
- package/dist/integrations/hooks/useProviders.d.ts.map +0 -1
- package/dist/integrations/index.d.ts +0 -33
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/pages/AddConnectionWizard.d.ts +0 -14
- package/dist/integrations/pages/AddConnectionWizard.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionDetail.d.ts +0 -5
- package/dist/integrations/pages/ConnectionDetail.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionLogs.d.ts +0 -5
- package/dist/integrations/pages/ConnectionLogs.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionsList.d.ts +0 -5
- package/dist/integrations/pages/ConnectionsList.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsAdminLandingPage.d.ts +0 -11
- package/dist/integrations/pages/IntegrationsAdminLandingPage.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsLandingPage.d.ts +0 -9
- package/dist/integrations/pages/IntegrationsLandingPage.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsOverview.d.ts +0 -5
- package/dist/integrations/pages/IntegrationsOverview.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsSettings.d.ts +0 -5
- package/dist/integrations/pages/IntegrationsSettings.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts +0 -11
- package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderCatalog.d.ts +0 -9
- package/dist/integrations/pages/ProviderCatalog.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderDetail.d.ts +0 -5
- package/dist/integrations/pages/ProviderDetail.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderEditorPage.d.ts +0 -2
- package/dist/integrations/pages/ProviderEditorPage.d.ts.map +0 -1
- package/dist/integrations/providers/IntegrationsProvider.d.ts +0 -13
- package/dist/integrations/providers/IntegrationsProvider.d.ts.map +0 -1
- package/dist/integrations/store/integrationsStore.d.ts +0 -21
- package/dist/integrations/store/integrationsStore.d.ts.map +0 -1
- package/dist/integrations/types/index.d.ts +0 -217
- package/dist/integrations/types/index.d.ts.map +0 -1
- package/dist/integrations/utils/appearance.d.ts +0 -14
- package/dist/integrations/utils/appearance.d.ts.map +0 -1
- package/dist/integrations/utils/cn.d.ts +0 -8
- package/dist/integrations/utils/cn.d.ts.map +0 -1
- package/dist/integrations/utils/constants.d.ts +0 -194
- package/dist/integrations/utils/constants.d.ts.map +0 -1
- package/dist/integrations/utils/i18n.d.ts +0 -6
- package/dist/integrations/utils/i18n.d.ts.map +0 -1
- package/dist/integrations/utils/integrationsHelpers.d.ts +0 -39
- package/dist/integrations/utils/integrationsHelpers.d.ts.map +0 -1
- package/dist/integrations/utils/mappers.d.ts +0 -15
- package/dist/integrations/utils/mappers.d.ts.map +0 -1
- package/dist/integrations/utils/navigation.d.ts +0 -18
- package/dist/integrations/utils/navigation.d.ts.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/paths.d.ts +0 -5
- package/dist/integrations/utils/paths.d.ts.map +0 -1
- package/dist/utils/nativeBridge.d.ts +0 -3
- package/dist/utils/nativeBridge.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionDetail.js","names":[],"sources":["../../../src/integrations/pages/ConnectionDetail.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n ArrowLeft,\n Loader2,\n AlertCircle,\n RefreshCw,\n Shield,\n Clock,\n Activity,\n CheckCircle2,\n XCircle,\n Key,\n RotateCcw,\n Zap,\n Mail,\n User,\n Trash2,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useI18n, usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useFeatureFlag } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { INTEGRATION_FEATURE_FLAGS } from '../constants/featureFlags';\nimport { joinPath } from '../utils/navigation';\nimport { formatDate, formatLastUsed, getAuthTypeLabel } from '../utils/integrationsHelpers';\nimport {\n useConnection,\n useTestConnection,\n useRefreshToken,\n useRevokeConnection,\n useDeleteConnection,\n} from '../hooks/useConnections';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport { ConnectionStatusBadge } from '../components/ConnectionStatusBadge';\nimport { ConfirmDialog } from '../components/ConfirmDialog';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../../utils/nativeBridge';\n\n/**\n * Connection Detail — Single connection view with info, scopes, and action buttons.\n */\nexport function ConnectionDetail() {\n const { connectionId } = useParams<{ connectionId: string }>();\n const { basePath = '/', navigate } = useIntegrations();\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) => {\n const translated = t(key, params);\n if (translated !== key) return translated;\n if (!params) return fallback;\n\n return Object.entries(params).reduce(\n (value, [paramKey, paramValue]) =>\n value\n .replace(`{{${paramKey}}}`, String(paramValue))\n .replace(`{${paramKey}}`, String(paramValue)),\n fallback\n );\n };\n\n const { connection, loading, error, refetch } = useConnection(connectionId ?? '');\n const { testConnection, loading: testing } = useTestConnection();\n const { refreshToken, loading: refreshing } = useRefreshToken();\n const { revokeConnection, loading: revoking } = useRevokeConnection();\n const { deleteConnection, loading: deleting } = useDeleteConnection();\n const canRefreshToken = useFeatureFlag(INTEGRATION_FEATURE_FLAGS.OAUTH_REFRESH, true);\n\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canUpdate = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_UPDATE);\n const canDelete = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_DELETE);\n\n const [testResult, setTestResult] = useState<{\n success: boolean;\n message: string;\n latencyMs: number;\n } | null>(null);\n const [notification, setNotification] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n const [deleteVaultSecret, setDeleteVaultSecret] = useState(false);\n const [revokeDialogOpen, setRevokeDialogOpen] = useState(false);\n\n const showNotification = (type: 'success' | 'error', message: string) => {\n setNotification({ type, message });\n setTimeout(() => setNotification(null), 5000);\n };\n\n if (loading || permissionsLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n <span className=\"mt-6 text-sm font-medium text-muted-foreground\">\n {tx('integrations.connectionDetail.loading', 'Loading connection details...')}\n </span>\n </div>\n );\n }\n\n if (error || !connection) {\n return (\n <div className=\"p-6 max-w-4xl mx-auto\">\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-6 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text flex-shrink-0\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">\n {tx('integrations.connectionDetail.error.title', 'Connection not found')}\n </h3>\n <p className=\"text-sm text-status-error-text mb-3\">\n {error?.message ||\n tx(\n 'integrations.connectionDetail.error.description',\n 'The requested connection could not be loaded.'\n )}\n </p>\n <div className=\"flex gap-2\">\n <button\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} />{' '}\n {tx('integrations.connectionDetail.error.retry', 'Try Again')}\n </button>\n <button\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={14} />{' '}\n {tx('integrations.connectionDetail.error.back', 'Back to Connections')}\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n const handleTest = async () => {\n const result = await testConnection(connection.id);\n if (result) {\n setTestResult(result);\n showNotification(result.success ? 'success' : 'error', result.message);\n }\n };\n\n const handleRefresh = async () => {\n await refreshToken(connection.id);\n showNotification(\n 'success',\n tx(\n 'integrations.connectionDetail.notifications.refreshSuccess',\n 'Token refreshed successfully'\n )\n );\n refetch();\n };\n\n const handleRevoke = async () => {\n setRevokeDialogOpen(true);\n };\n\n const confirmRevoke = async () => {\n await revokeConnection(connection.id);\n showNotification(\n 'success',\n tx('integrations.connectionDetail.notifications.revokeSuccess', 'Connection revoked')\n );\n setRevokeDialogOpen(false);\n refetch();\n };\n\n const handleDelete = async () => {\n void nativeImpact('medium');\n const result = await nativeConfirm({\n title: tx('integrations.connectionDetail.deleteDialog.title', 'Delete Connection'),\n message: tx(\n 'integrations.connectionDetail.deleteDialog.message',\n 'Delete this connection? This cannot be undone.'\n ),\n okButtonTitle: tx('integrations.connectionDetail.deleteDialog.confirm', 'Delete'),\n cancelButtonTitle: tx('integrations.connectionDetail.deleteDialog.cancel', 'Cancel'),\n });\n if (result === null) {\n setDeleteDialogOpen(true);\n return;\n }\n if (result) {\n await confirmDelete();\n }\n };\n\n const confirmDelete = async () => {\n try {\n await deleteConnection(connection.id, deleteVaultSecret);\n showNotification(\n 'success',\n tx('integrations.connectionDetail.notifications.deleteSuccess', 'Connection deleted')\n );\n void nativeNotify('success');\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n navigate?.(joinPath(basePath, 'connections'));\n } catch (error) {\n showNotification(\n 'error',\n error instanceof Error ? error.message : 'Failed to delete connection'\n );\n void nativeNotify('error');\n }\n };\n\n const actionLoading = testing || refreshing || revoking || deleting;\n const usesVaultCredentials = Boolean(connection.vaultId || connection.credentialSecretId);\n\n return (\n <div className=\"space-y-6 p-6 max-w-5xl mx-auto\">\n {/* Notification */}\n {notification && (\n <div\n className={cn(\n 'fixed top-4 right-4 z-50 flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-300',\n notification.type === 'success'\n ? 'bg-status-success-bg-subtle text-status-success-text border-border-default'\n : 'bg-status-error-bg-subtle text-status-error-text border-border-default'\n )}\n >\n {notification.type === 'success' ? <CheckCircle2 size={20} /> : <XCircle size={20} />}\n <span className=\"font-medium\">{notification.message}</span>\n </div>\n )}\n\n {deleteDialogOpen && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-foreground/40 px-4\">\n <div className=\"w-full max-w-md rounded-xl border border-border bg-background p-6 shadow-2xl space-y-4\">\n <div>\n <h2 className=\"text-lg font-semibold text-foreground\">Delete connection</h2>\n <p className=\"text-sm text-muted-foreground mt-1\">\n This removes the connection record immediately. You can also remove the mapped vault\n secret if you no longer need it.\n </p>\n </div>\n\n {usesVaultCredentials && (\n <label className=\"flex items-start gap-3 rounded-lg border border-border/60 bg-card px-4 py-3 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={deleteVaultSecret}\n onChange={(event) => setDeleteVaultSecret(event.target.checked)}\n className=\"mt-0.5\"\n />\n <div>\n <p className=\"text-sm font-medium text-foreground\">\n Also remove mapped vault secret\n </p>\n <p className=\"text-xs text-muted-foreground mt-1\">\n Use this only if no other connections rely on the same secret.\n </p>\n </div>\n </label>\n )}\n\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={() => {\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n }}\n className=\"px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={confirmDelete}\n disabled={deleting}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-destructive text-primary-foreground disabled:opacity-50\"\n >\n {deleting ? <Loader2 size={14} className=\"animate-spin\" /> : <Trash2 size={14} />}\n Delete connection\n </button>\n </div>\n </div>\n </div>\n )}\n\n <ConfirmDialog\n open={revokeDialogOpen}\n title={tx('integrations.connectionDetail.confirm.revokeTitle', 'Revoke connection')}\n description={tx(\n 'integrations.connectionDetail.confirm.revoke',\n 'Are you sure you want to revoke this connection? This will disconnect the external service.'\n )}\n confirmLabel={tx('integrations.connectionDetail.actions.revoke', 'Revoke')}\n cancelLabel={tx('integrations.connectionDetail.actions.cancel', 'Cancel')}\n loading={revoking}\n destructive\n icon={<Shield size={20} />}\n onConfirm={confirmRevoke}\n onCancel={() => setRevokeDialogOpen(false)}\n />\n\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm\">\n <div className=\"relative z-10 flex items-center gap-4\">\n <button\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label={tx('integrations.connectionDetail.actions.backAriaLabel', 'Back')}\n >\n <ArrowLeft size={20} />\n </button>\n <ProviderIcon provider={connection.provider} size={56} />\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-2xl sm:text-3xl font-bold text-foreground\">{connection.name}</h1>\n <ConnectionStatusBadge status={connection.status} size=\"md\" />\n </div>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n {connection.provider.name} · {getAuthTypeLabel(connection.provider.authType)}\n </p>\n </div>\n </div>\n <div className=\"absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0\" />\n </div>\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {/* Connection Info */}\n <div className=\"rounded-xl border border-border/50 bg-card p-5 space-y-4\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2\">\n <Activity size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.info', 'Connection Info')}\n </h2>\n <div className=\"space-y-3\">\n {connection.description && (\n <div className=\"py-2 border-b border-border/50\">\n <span className=\"text-xs text-muted-foreground uppercase tracking-wide\">\n {tx('integrations.connectionDetail.fields.description', 'Description')}\n </span>\n <p className=\"text-sm text-foreground mt-0.5\">{connection.description}</p>\n </div>\n )}\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.fields.provider', 'Provider')}\n </span>\n <span className=\"text-sm font-medium text-foreground\">\n {connection.provider.name}\n </span>\n </div>\n {connection.externalAccountEmail && (\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground flex items-center gap-1\">\n <Mail size={14} /> {tx('integrations.connectionDetail.fields.account', 'Account')}\n </span>\n <span className=\"text-sm font-medium text-foreground\">\n {connection.externalAccountEmail}\n </span>\n </div>\n )}\n {connection.externalAccountName && (\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground flex items-center gap-1\">\n <User size={14} /> {tx('integrations.connectionDetail.fields.name', 'Name')}\n </span>\n <span className=\"text-sm font-medium text-foreground\">\n {connection.externalAccountName}\n </span>\n </div>\n )}\n {connection.errorMessage && (\n <div className=\"py-2 border-b border-border/50\">\n <span className=\"text-xs text-status-error-text uppercase tracking-wide\">\n {tx('integrations.connectionDetail.fields.error', 'Error')}\n </span>\n <p className=\"text-sm text-status-error-text mt-0.5 bg-status-error-bg-subtle rounded-lg p-2\">\n {connection.errorMessage}\n </p>\n </div>\n )}\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground flex items-center gap-1\">\n <Clock size={14} />{' '}\n {tx('integrations.connectionDetail.fields.lastUsed', 'Last Used')}\n </span>\n <span className=\"text-sm text-foreground\">\n {formatLastUsed(connection.lastUsedAt)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.fields.healthCheck', 'Health Check')}\n </span>\n <span className=\"text-sm text-foreground\">\n {formatDate(connection.lastHealthCheck)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2\">\n <span className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.fields.created', 'Created')}\n </span>\n <span className=\"text-sm text-foreground\">{formatDate(connection.createdAt)}</span>\n </div>\n </div>\n </div>\n\n {/* Scopes & Actions */}\n <div className=\"space-y-4\">\n {/* Granted Scopes */}\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-3\">\n <Shield size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.scopes', 'Granted Scopes')}\n </h2>\n {connection.grantedScopes.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {connection.grantedScopes.map((scope) => (\n <span\n key={scope}\n className=\"text-xs px-2.5 py-1 rounded-full bg-muted text-muted-foreground font-mono\"\n >\n {scope}\n </span>\n ))}\n </div>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.scopes.empty', 'No scopes granted.')}\n </p>\n )}\n </div>\n\n {/* Test Result */}\n {testResult && (\n <div\n className={cn(\n 'rounded-xl border p-5',\n testResult.success\n ? 'border-border-default bg-status-success-bg-subtle'\n : 'border-border-default bg-status-error-bg-subtle'\n )}\n >\n <h2\n className={cn(\n 'font-semibold flex items-center gap-2 mb-2',\n testResult.success ? 'text-status-success-text' : 'text-status-error-text'\n )}\n >\n {testResult.success ? <CheckCircle2 size={18} /> : <XCircle size={18} />}\n {testResult.success\n ? tx('integrations.connectionDetail.testResult.passed', 'Connection Test Passed')\n : tx('integrations.connectionDetail.testResult.failed', 'Connection Test Failed')}\n </h2>\n <p\n className={cn(\n 'text-sm',\n testResult.success ? 'text-status-success-text' : 'text-status-error-text'\n )}\n >\n {testResult.message}\n </p>\n <p className=\"text-xs text-muted-foreground mt-1\">\n {tx('integrations.connectionDetail.testResult.latency', 'Latency: {latency}ms', {\n latency: testResult.latencyMs,\n })}\n </p>\n </div>\n )}\n\n {usesVaultCredentials && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-3\">\n <Key size={18} className=\"text-primary\" />\n Credential Storage\n </h2>\n <div className=\"space-y-2 text-sm\">\n {connection.vaultId && (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-muted-foreground\">Vault</span>\n <span className=\"font-medium text-foreground break-all\">\n {connection.vaultId}\n </span>\n </div>\n )}\n {connection.credentialSecretName && (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-muted-foreground\">Secret</span>\n <span className=\"font-medium text-foreground break-all\">\n {connection.credentialSecretName}\n </span>\n </div>\n )}\n {connection.credentialSecretId && (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-muted-foreground\">Secret ID</span>\n <span className=\"font-mono text-xs text-foreground break-all\">\n {connection.credentialSecretId}\n </span>\n </div>\n )}\n </div>\n </div>\n )}\n\n {/* Actions — hidden entirely when user has no action permissions */}\n {(canUpdate || canDelete) && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-3\">\n <Key size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.actions', 'Actions')}\n </h2>\n <div className=\"flex flex-wrap gap-2\">\n <button\n onClick={handleTest}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50\"\n >\n {testing ? <Loader2 size={14} className=\"animate-spin\" /> : <Zap size={14} />}\n {tx('integrations.connectionDetail.actions.test', 'Test Connection')}\n </button>\n {canUpdate && connection.provider.authType === 'oauth2' && canRefreshToken && (\n <button\n onClick={handleRefresh}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50\"\n >\n {refreshing ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <RotateCcw size={14} />\n )}\n {tx('integrations.connectionDetail.actions.refreshToken', 'Refresh Token')}\n </button>\n )}\n {canDelete && (\n <button\n onClick={handleRevoke}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-default text-status-warning-text hover:bg-status-warning-bg-subtle transition-colors disabled:opacity-50\"\n >\n {revoking ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Shield size={14} />\n )}\n {tx('integrations.connectionDetail.actions.revoke', 'Revoke')}\n </button>\n )}\n {canDelete && (\n <button\n onClick={handleDelete}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-default text-status-error-text hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50\"\n >\n {deleting ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Trash2 size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EP;UACF;;MAEJ;OACF;;GACF"}
|
|
1
|
+
{"version":3,"file":"ConnectionDetail.js","names":[],"sources":["../../../src/integrations/pages/ConnectionDetail.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useParams } from 'react-router-dom';\nimport {\n ArrowLeft,\n Loader2,\n AlertCircle,\n RefreshCw,\n Shield,\n Clock,\n Activity,\n CheckCircle2,\n XCircle,\n Key,\n RotateCcw,\n Zap,\n Mail,\n User,\n Trash2,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useI18n, usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useFeatureFlag } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { INTEGRATION_FEATURE_FLAGS } from '../constants/featureFlags';\nimport { joinPath } from '../utils/navigation';\nimport { formatDate, formatLastUsed, getAuthTypeLabel } from '../utils/integrationsHelpers';\nimport {\n useConnection,\n useTestConnection,\n useRefreshToken,\n useRevokeConnection,\n useDeleteConnection,\n} from '../hooks/useConnections';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport { ConnectionStatusBadge } from '../components/ConnectionStatusBadge';\nimport { ConfirmDialog } from '../components/ConfirmDialog';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../../utils/nativeBridge';\n\n/**\n * Connection Detail — Single connection view with info, scopes, and action buttons.\n */\nexport function ConnectionDetail() {\n const { connectionId } = useParams<{ connectionId: string }>();\n const { basePath = '/', navigate } = useIntegrations();\n const { t } = useI18n();\n const tx = (key: string, fallback: string, params?: Record<string, string | number>) => {\n const translated = t(key, params);\n if (translated !== key) return translated;\n if (!params) return fallback;\n\n return Object.entries(params).reduce(\n (value, [paramKey, paramValue]) =>\n value\n .replace(`{{${paramKey}}}`, String(paramValue))\n .replace(`{${paramKey}}`, String(paramValue)),\n fallback\n );\n };\n\n const { connection, loading, error, refetch } = useConnection(connectionId ?? '');\n const { testConnection, loading: testing } = useTestConnection();\n const { refreshToken, loading: refreshing } = useRefreshToken();\n const { revokeConnection, loading: revoking } = useRevokeConnection();\n const { deleteConnection, loading: deleting } = useDeleteConnection();\n const canRefreshToken = useFeatureFlag(INTEGRATION_FEATURE_FLAGS.OAUTH_REFRESH, true);\n\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canUpdate = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_UPDATE);\n const canDelete = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_DELETE);\n\n const [testResult, setTestResult] = useState<{\n success: boolean;\n message: string;\n latencyMs: number;\n } | null>(null);\n const [notification, setNotification] = useState<{\n type: 'success' | 'error';\n message: string;\n } | null>(null);\n const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n const [deleteVaultSecret, setDeleteVaultSecret] = useState(false);\n const [revokeDialogOpen, setRevokeDialogOpen] = useState(false);\n\n const showNotification = (type: 'success' | 'error', message: string) => {\n setNotification({ type, message });\n setTimeout(() => setNotification(null), 5000);\n };\n\n if (loading || permissionsLoading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n <span className=\"mt-6 text-sm font-medium text-muted-foreground\">\n {tx('integrations.connectionDetail.loading', 'Loading connection details...')}\n </span>\n </div>\n );\n }\n\n if (error || !connection) {\n return (\n <div className=\"p-6 max-w-4xl mx-auto\">\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-6 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text flex-shrink-0\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">\n {tx('integrations.connectionDetail.error.title', 'Connection not found')}\n </h3>\n <p className=\"text-sm text-status-error-text mb-3\">\n {error?.message ||\n tx(\n 'integrations.connectionDetail.error.description',\n 'The requested connection could not be loaded.'\n )}\n </p>\n <div className=\"flex gap-2\">\n <button type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} />{' '}\n {tx('integrations.connectionDetail.error.retry', 'Try Again')}\n </button>\n <button type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={14} />{' '}\n {tx('integrations.connectionDetail.error.back', 'Back to Connections')}\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n const handleTest = async () => {\n const result = await testConnection(connection.id);\n if (result) {\n setTestResult(result);\n showNotification(result.success ? 'success' : 'error', result.message);\n }\n };\n\n const handleRefresh = async () => {\n await refreshToken(connection.id);\n showNotification(\n 'success',\n tx(\n 'integrations.connectionDetail.notifications.refreshSuccess',\n 'Token refreshed successfully'\n )\n );\n refetch();\n };\n\n const handleRevoke = async () => {\n setRevokeDialogOpen(true);\n };\n\n const confirmRevoke = async () => {\n await revokeConnection(connection.id);\n showNotification(\n 'success',\n tx('integrations.connectionDetail.notifications.revokeSuccess', 'Connection revoked')\n );\n setRevokeDialogOpen(false);\n refetch();\n };\n\n const handleDelete = async () => {\n void nativeImpact('medium');\n const result = await nativeConfirm({\n title: tx('integrations.connectionDetail.deleteDialog.title', 'Delete Connection'),\n message: tx(\n 'integrations.connectionDetail.deleteDialog.message',\n 'Delete this connection? This cannot be undone.'\n ),\n okButtonTitle: tx('integrations.connectionDetail.deleteDialog.confirm', 'Delete'),\n cancelButtonTitle: tx('integrations.connectionDetail.deleteDialog.cancel', 'Cancel'),\n });\n if (result === null) {\n setDeleteDialogOpen(true);\n return;\n }\n if (result) {\n await confirmDelete();\n }\n };\n\n const confirmDelete = async () => {\n try {\n await deleteConnection(connection.id, deleteVaultSecret);\n showNotification(\n 'success',\n tx('integrations.connectionDetail.notifications.deleteSuccess', 'Connection deleted')\n );\n void nativeNotify('success');\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n navigate?.(joinPath(basePath, 'connections'));\n } catch (error) {\n showNotification(\n 'error',\n error instanceof Error ? error.message : 'Failed to delete connection'\n );\n void nativeNotify('error');\n }\n };\n\n const actionLoading = testing || refreshing || revoking || deleting;\n const usesVaultCredentials = Boolean(connection.vaultId || connection.credentialSecretId);\n\n return (\n <div className=\"space-y-6 p-6 max-w-5xl mx-auto\">\n {/* Notification */}\n {notification && (\n <div\n className={cn(\n 'fixed top-4 right-4 z-50 flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-300',\n notification.type === 'success'\n ? 'bg-status-success-bg-subtle text-status-success-text border-border-default'\n : 'bg-status-error-bg-subtle text-status-error-text border-border-default'\n )}\n >\n {notification.type === 'success' ? <CheckCircle2 size={20} /> : <XCircle size={20} />}\n <span className=\"font-medium\">{notification.message}</span>\n </div>\n )}\n\n {deleteDialogOpen && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-foreground/40 px-4\">\n <div className=\"w-full max-w-md rounded-xl border border-border bg-background p-6 shadow-2xl space-y-4\">\n <div>\n <h2 className=\"text-lg font-semibold text-foreground\">Delete connection</h2>\n <p className=\"text-sm text-muted-foreground mt-1\">\n This removes the connection record immediately. You can also remove the mapped vault\n secret if you no longer need it.\n </p>\n </div>\n\n {usesVaultCredentials && (\n <label className=\"flex items-start gap-3 rounded-lg border border-border/60 bg-card px-4 py-3 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={deleteVaultSecret}\n onChange={(event) => setDeleteVaultSecret(event.target.checked)}\n className=\"mt-0.5\"\n />\n <div>\n <p className=\"text-sm font-medium text-foreground\">\n Also remove mapped vault secret\n </p>\n <p className=\"text-xs text-muted-foreground mt-1\">\n Use this only if no other connections rely on the same secret.\n </p>\n </div>\n </label>\n )}\n\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={() => {\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n }}\n className=\"px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={confirmDelete}\n disabled={deleting}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-destructive text-primary-foreground disabled:opacity-50\"\n >\n {deleting ? <Loader2 size={14} className=\"animate-spin\" /> : <Trash2 size={14} />}\n Delete connection\n </button>\n </div>\n </div>\n </div>\n )}\n\n <ConfirmDialog\n open={revokeDialogOpen}\n title={tx('integrations.connectionDetail.confirm.revokeTitle', 'Revoke connection')}\n description={tx(\n 'integrations.connectionDetail.confirm.revoke',\n 'Are you sure you want to revoke this connection? This will disconnect the external service.'\n )}\n confirmLabel={tx('integrations.connectionDetail.actions.revoke', 'Revoke')}\n cancelLabel={tx('integrations.connectionDetail.actions.cancel', 'Cancel')}\n loading={revoking}\n destructive\n icon={<Shield size={20} />}\n onConfirm={confirmRevoke}\n onCancel={() => setRevokeDialogOpen(false)}\n />\n\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm\">\n <div className=\"relative z-10 flex items-center gap-4\">\n <button type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label={tx('integrations.connectionDetail.actions.backAriaLabel', 'Back')}\n >\n <ArrowLeft size={20} />\n </button>\n <ProviderIcon provider={connection.provider} size={56} />\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-2xl sm:text-3xl font-bold text-foreground\">{connection.name}</h1>\n <ConnectionStatusBadge status={connection.status} size=\"md\" />\n </div>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n {connection.provider.name} · {getAuthTypeLabel(connection.provider.authType)}\n </p>\n </div>\n </div>\n <div className=\"absolute top-0 right-0 size-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0\" />\n </div>\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {/* Connection Info */}\n <div className=\"rounded-xl border border-border/50 bg-card p-5 space-y-4\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2\">\n <Activity size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.info', 'Connection Info')}\n </h2>\n <div className=\"space-y-3\">\n {connection.description && (\n <div className=\"py-2 border-b border-border/50\">\n <span className=\"text-xs text-muted-foreground uppercase tracking-wide\">\n {tx('integrations.connectionDetail.fields.description', 'Description')}\n </span>\n <p className=\"text-sm text-foreground mt-0.5\">{connection.description}</p>\n </div>\n )}\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.fields.provider', 'Provider')}\n </span>\n <span className=\"text-sm font-medium text-foreground\">\n {connection.provider.name}\n </span>\n </div>\n {connection.externalAccountEmail && (\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground flex items-center gap-1\">\n <Mail size={14} /> {tx('integrations.connectionDetail.fields.account', 'Account')}\n </span>\n <span className=\"text-sm font-medium text-foreground\">\n {connection.externalAccountEmail}\n </span>\n </div>\n )}\n {connection.externalAccountName && (\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground flex items-center gap-1\">\n <User size={14} /> {tx('integrations.connectionDetail.fields.name', 'Name')}\n </span>\n <span className=\"text-sm font-medium text-foreground\">\n {connection.externalAccountName}\n </span>\n </div>\n )}\n {connection.errorMessage && (\n <div className=\"py-2 border-b border-border/50\">\n <span className=\"text-xs text-status-error-text uppercase tracking-wide\">\n {tx('integrations.connectionDetail.fields.error', 'Error')}\n </span>\n <p className=\"text-sm text-status-error-text mt-0.5 bg-status-error-bg-subtle rounded-lg p-2\">\n {connection.errorMessage}\n </p>\n </div>\n )}\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground flex items-center gap-1\">\n <Clock size={14} />{' '}\n {tx('integrations.connectionDetail.fields.lastUsed', 'Last Used')}\n </span>\n <span className=\"text-sm text-foreground\">\n {formatLastUsed(connection.lastUsedAt)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border/50\">\n <span className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.fields.healthCheck', 'Health Check')}\n </span>\n <span className=\"text-sm text-foreground\">\n {formatDate(connection.lastHealthCheck)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2\">\n <span className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.fields.created', 'Created')}\n </span>\n <span className=\"text-sm text-foreground\">{formatDate(connection.createdAt)}</span>\n </div>\n </div>\n </div>\n\n {/* Scopes & Actions */}\n <div className=\"space-y-4\">\n {/* Granted Scopes */}\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-3\">\n <Shield size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.scopes', 'Granted Scopes')}\n </h2>\n {connection.grantedScopes.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {connection.grantedScopes.map((scope) => (\n <span\n key={scope}\n className=\"text-xs px-2.5 py-1 rounded-full bg-muted text-muted-foreground font-mono\"\n >\n {scope}\n </span>\n ))}\n </div>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n {tx('integrations.connectionDetail.scopes.empty', 'No scopes granted.')}\n </p>\n )}\n </div>\n\n {/* Test Result */}\n {testResult && (\n <div\n className={cn(\n 'rounded-xl border p-5',\n testResult.success\n ? 'border-border-default bg-status-success-bg-subtle'\n : 'border-border-default bg-status-error-bg-subtle'\n )}\n >\n <h2\n className={cn(\n 'font-semibold flex items-center gap-2 mb-2',\n testResult.success ? 'text-status-success-text' : 'text-status-error-text'\n )}\n >\n {testResult.success ? <CheckCircle2 size={18} /> : <XCircle size={18} />}\n {testResult.success\n ? tx('integrations.connectionDetail.testResult.passed', 'Connection Test Passed')\n : tx('integrations.connectionDetail.testResult.failed', 'Connection Test Failed')}\n </h2>\n <p\n className={cn(\n 'text-sm',\n testResult.success ? 'text-status-success-text' : 'text-status-error-text'\n )}\n >\n {testResult.message}\n </p>\n <p className=\"text-xs text-muted-foreground mt-1\">\n {tx('integrations.connectionDetail.testResult.latency', 'Latency: {latency}ms', {\n latency: testResult.latencyMs,\n })}\n </p>\n </div>\n )}\n\n {usesVaultCredentials && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-3\">\n <Key size={18} className=\"text-primary\" />\n Credential Storage\n </h2>\n <div className=\"space-y-2 text-sm\">\n {connection.vaultId && (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-muted-foreground\">Vault</span>\n <span className=\"font-medium text-foreground break-all\">\n {connection.vaultId}\n </span>\n </div>\n )}\n {connection.credentialSecretName && (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-muted-foreground\">Secret</span>\n <span className=\"font-medium text-foreground break-all\">\n {connection.credentialSecretName}\n </span>\n </div>\n )}\n {connection.credentialSecretId && (\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-muted-foreground\">Secret ID</span>\n <span className=\"font-mono text-xs text-foreground break-all\">\n {connection.credentialSecretId}\n </span>\n </div>\n )}\n </div>\n </div>\n )}\n\n {/* Actions — hidden entirely when user has no action permissions */}\n {(canUpdate || canDelete) && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-3\">\n <Key size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.actions', 'Actions')}\n </h2>\n <div className=\"flex flex-wrap gap-2\">\n <button type=\"button\"\n onClick={handleTest}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50\"\n >\n {testing ? <Loader2 size={14} className=\"animate-spin\" /> : <Zap size={14} />}\n {tx('integrations.connectionDetail.actions.test', 'Test Connection')}\n </button>\n {canUpdate && connection.provider.authType === 'oauth2' && canRefreshToken && (\n <button type=\"button\"\n onClick={handleRefresh}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50\"\n >\n {refreshing ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <RotateCcw size={14} />\n )}\n {tx('integrations.connectionDetail.actions.refreshToken', 'Refresh Token')}\n </button>\n )}\n {canDelete && (\n <button type=\"button\"\n onClick={handleRevoke}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-default text-status-warning-text hover:bg-status-warning-bg-subtle transition-colors disabled:opacity-50\"\n >\n {revoking ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Shield size={14} />\n )}\n {tx('integrations.connectionDetail.actions.revoke', 'Revoke')}\n </button>\n )}\n {canDelete && (\n <button type=\"button\"\n onClick={handleDelete}\n disabled={actionLoading}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-default text-status-error-text hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50\"\n >\n {deleting ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Trash2 size={14} />\n )}\n {tx('integrations.connectionDetail.actions.delete', 'Delete')}\n </button>\n )}\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,SAAgB,IAAmB;CACjC,IAAM,EAAE,oBAAiB,IAAqC,EACxD,EAAE,cAAW,KAAK,gBAAa,GAAiB,EAChD,EAAE,SAAM,IAAS,EACjB,KAAM,GAAa,GAAkB,MAA6C;E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;kBAAd,CACE,kBAAC,GAAD;SAAK,MAAM;SAAI,WAAU;SAAiB,CAAA,EACzC,EAAG,kDAAkD,UAAU,CAC7D;WACL,kBAAC,OAAD;QAAK,WAAU;kBAAf;SACE,kBAAC,UAAD;UAAQ,MAAK;UACX,SAAS;UACT,UAAU;UACV,WAAU;oBAHZ,CAKG,IAAU,kBAAC,GAAD;WAAS,MAAM;WAAI,WAAU;WAAiB,CAAA,GAAG,kBAAC,IAAD,EAAK,MAAM,IAAM,CAAA,EAC5E,EAAG,8CAA8C,kBAAkB,CAC7D;;SACR,KAAa,EAAW,SAAS,aAAa,YAAY,MACzD,kBAAC,UAAD;UAAQ,MAAK;UACX,SAAS;UACT,UAAU;UACV,WAAU;oBAHZ,CAKG,IACC,kBAAC,GAAD;WAAS,MAAM;WAAI,WAAU;WAAiB,CAAA,GAE9C,kBAAC,IAAD,EAAW,MAAM,IAAM,CAAA,EAExB,EAAG,sDAAsD,gBAAgB,CACnE;;SAEV,KACC,kBAAC,UAAD;UAAQ,MAAK;UACX,SAAS;UACT,UAAU;UACV,WAAU;oBAHZ,CAKG,IACC,kBAAC,GAAD;WAAS,MAAM;WAAI,WAAU;WAAiB,CAAA,GAE9C,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA,EAErB,EAAG,gDAAgD,SAAS,CACtD;;SAEV,KACC,kBAAC,UAAD;UAAQ,MAAK;UACX,SAAS;UACT,UAAU;UACV,WAAU;oBAHZ,CAKG,IACC,kBAAC,GAAD;WAAS,MAAM;WAAI,WAAU;WAAiB,CAAA,GAE9C,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA,EAErB,EAAG,gDAAgD,SAAS,CACtD;;SAEP;UACF;;MAEJ;OACF;;GACF"}
|
|
@@ -96,6 +96,7 @@ function P() {
|
|
|
96
96
|
className: "relative z-10 flex items-center gap-4",
|
|
97
97
|
children: [
|
|
98
98
|
/* @__PURE__ */ D("button", {
|
|
99
|
+
type: "button",
|
|
99
100
|
onClick: () => f?.(u),
|
|
100
101
|
className: "p-2.5 hover:bg-accent rounded-lg transition-all",
|
|
101
102
|
"aria-label": "Back",
|
|
@@ -116,7 +117,7 @@ function P() {
|
|
|
116
117
|
children: "Track integration activity and debug issues"
|
|
117
118
|
})] })
|
|
118
119
|
]
|
|
119
|
-
}), /* @__PURE__ */ D("div", { className: "absolute top-0 right-0
|
|
120
|
+
}), /* @__PURE__ */ D("div", { className: "absolute top-0 right-0 size-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0" })]
|
|
120
121
|
}),
|
|
121
122
|
/* @__PURE__ */ O("div", {
|
|
122
123
|
className: "space-y-4",
|
|
@@ -138,6 +139,7 @@ function P() {
|
|
|
138
139
|
})]
|
|
139
140
|
}),
|
|
140
141
|
/* @__PURE__ */ O("button", {
|
|
142
|
+
type: "button",
|
|
141
143
|
onClick: () => H(!V),
|
|
142
144
|
"aria-expanded": V,
|
|
143
145
|
className: t("inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-all", V || Q ? "bg-primary text-primary-foreground border-primary" : "bg-background text-foreground border-border hover:bg-accent"),
|
|
@@ -153,6 +155,7 @@ function P() {
|
|
|
153
155
|
children: [/* @__PURE__ */ D(_, { size: 16 }), " Export CSV"]
|
|
154
156
|
}),
|
|
155
157
|
/* @__PURE__ */ O("button", {
|
|
158
|
+
type: "button",
|
|
156
159
|
onClick: () => Y(),
|
|
157
160
|
className: "inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",
|
|
158
161
|
children: [/* @__PURE__ */ D(S, { size: 16 }), " Refresh"]
|
|
@@ -169,6 +172,7 @@ function P() {
|
|
|
169
172
|
className: "text-primary"
|
|
170
173
|
}), " Filters"]
|
|
171
174
|
}), Q && /* @__PURE__ */ O("button", {
|
|
175
|
+
type: "button",
|
|
172
176
|
onClick: $,
|
|
173
177
|
className: "text-sm text-muted-foreground hover:text-destructive flex items-center gap-1",
|
|
174
178
|
children: [/* @__PURE__ */ D(w, { size: 14 }), " Clear All"]
|
|
@@ -234,6 +238,7 @@ function P() {
|
|
|
234
238
|
children: J.message
|
|
235
239
|
}),
|
|
236
240
|
/* @__PURE__ */ O("button", {
|
|
241
|
+
type: "button",
|
|
237
242
|
onClick: () => Y(),
|
|
238
243
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors",
|
|
239
244
|
children: [/* @__PURE__ */ D(S, { size: 14 }), " Try Again"]
|
|
@@ -318,6 +323,7 @@ function P() {
|
|
|
318
323
|
children: Q ? "Try adjusting your filters." : "Activity logs will appear here once you start using integrations."
|
|
319
324
|
}),
|
|
320
325
|
Q && /* @__PURE__ */ O("button", {
|
|
326
|
+
type: "button",
|
|
321
327
|
onClick: $,
|
|
322
328
|
className: "mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
323
329
|
children: [/* @__PURE__ */ D(w, { size: 14 }), " Clear Filters"]
|
|
@@ -339,6 +345,7 @@ function P() {
|
|
|
339
345
|
className: "flex items-center gap-2",
|
|
340
346
|
children: [
|
|
341
347
|
/* @__PURE__ */ D("button", {
|
|
348
|
+
type: "button",
|
|
342
349
|
onClick: () => W((e) => Math.max(1, e - 1)),
|
|
343
350
|
disabled: U === 1,
|
|
344
351
|
"aria-label": "Previous page",
|
|
@@ -354,6 +361,7 @@ function P() {
|
|
|
354
361
|
]
|
|
355
362
|
}),
|
|
356
363
|
/* @__PURE__ */ D("button", {
|
|
364
|
+
type: "button",
|
|
357
365
|
onClick: () => W((e) => Math.min(Z, e + 1)),
|
|
358
366
|
disabled: U === Z,
|
|
359
367
|
"aria-label": "Next page",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionLogs.js","names":[],"sources":["../../../src/integrations/pages/ConnectionLogs.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport {\n FileText,\n Search,\n Filter,\n X,\n AlertCircle,\n RefreshCw,\n ArrowLeft,\n Loader2,\n ChevronLeft,\n ChevronRight,\n Info,\n AlertTriangle,\n Bug,\n Activity,\n Download,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useFeatureFlag } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { INTEGRATION_FEATURE_FLAGS } from '../constants/featureFlags';\nimport { formatDate } from '../utils/integrationsHelpers';\nimport { useIntegrationLogs } from '../hooks/useLogs';\nimport { LOG_LEVEL_OPTIONS, LOG_ACTION_OPTIONS, DEFAULT_PAGE_SIZE } from '../utils/constants';\nimport type { IntegrationLog, LogLevel, LogAction } from '../types';\n\nfunction getLogLevelIcon(level: LogLevel) {\n switch (level) {\n case 'error':\n return <AlertCircle size={14} className=\"text-status-error-text\" />;\n case 'warn':\n return <AlertTriangle size={14} className=\"text-status-warning-text\" />;\n case 'info':\n return <Info size={14} className=\"text-status-info-text\" />;\n case 'debug':\n return <Bug size={14} className=\"text-text-tertiary\" />;\n default:\n return <Activity size={14} className=\"text-text-tertiary\" />;\n }\n}\n\nfunction getLogLevelColor(level: LogLevel): string {\n switch (level) {\n case 'error':\n return 'text-status-error-text bg-status-error-bg-subtle border-border-default';\n case 'warn':\n return 'text-status-warning-text bg-status-warning-bg-subtle border-border-default';\n case 'info':\n return 'text-status-info-text bg-status-info-bg-subtle border-border-default';\n case 'debug':\n return 'text-text-secondary bg-bg-sunken border-border-subtle';\n default:\n return 'text-text-secondary bg-bg-sunken border-border-subtle';\n }\n}\n\nfunction toCsvCell(value: string | number | null): string {\n const text = String(value ?? '');\n return `\"${text.replaceAll('\"', '\"\"')}\"`;\n}\n\nfunction downloadLogsCsv(logs: IntegrationLog[]) {\n const header = [\n 'Created At',\n 'Level',\n 'Action',\n 'Message',\n 'Request Method',\n 'Request URL',\n 'Status',\n ];\n const rows = logs.map((log) => [\n log.createdAt,\n log.level,\n log.action,\n log.message,\n log.requestMethod,\n log.requestUrl,\n log.responseStatus,\n ]);\n const csv = [header, ...rows].map((row) => row.map(toCsvCell).join(',')).join('\\n');\n const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = `integration-logs-${new Date().toISOString().slice(0, 10)}.csv`;\n link.click();\n URL.revokeObjectURL(url);\n}\n\n/**\n * Connection Logs — activity log view with filtering and pagination.\n */\nexport function ConnectionLogs() {\n const { basePath = '/', navigate } = useIntegrations();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canReadLogs = hasPermission(INTEGRATION_PERMISSIONS.LOG_READ);\n const canExportCsv = useFeatureFlag(INTEGRATION_FEATURE_FLAGS.CSV_EXPORT, true);\n\n const [searchQuery, setSearchQuery] = useState('');\n const [levelFilter, setLevelFilter] = useState<LogLevel | 'all'>('all');\n const [actionFilter, setActionFilter] = useState<LogAction | 'all'>('all');\n const [showFilters, setShowFilters] = useState(false);\n const [currentPage, setCurrentPage] = useState(1);\n\n const { logs, total, loading, error, refetch } = useIntegrationLogs({\n level: levelFilter === 'all' ? undefined : levelFilter,\n action: actionFilter === 'all' ? undefined : actionFilter,\n page: currentPage,\n pageSize: DEFAULT_PAGE_SIZE,\n skip: permissionsLoading || !canReadLogs,\n });\n\n // Client-side search filter\n const filteredLogs = useMemo(() => {\n if (!searchQuery) return logs ?? [];\n const q = searchQuery.toLowerCase();\n return (logs ?? []).filter(\n (log: IntegrationLog) =>\n log.message.toLowerCase().includes(q) ||\n (log.requestUrl?.toLowerCase().includes(q) ?? false)\n );\n }, [logs, searchQuery]);\n\n const totalPages = Math.ceil((total ?? 0) / DEFAULT_PAGE_SIZE);\n\n const hasActiveFilters = searchQuery || levelFilter !== 'all' || actionFilter !== 'all';\n\n const handleClearFilters = () => {\n setSearchQuery('');\n setLevelFilter('all');\n setActionFilter('all');\n setCurrentPage(1);\n };\n\n const handleExport = () => {\n downloadLogsCsv(filteredLogs);\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n </div>\n );\n }\n\n if (!canReadLogs) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-center p-6\">\n <AlertCircle size={48} className=\"text-muted-foreground mb-4\" />\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Access Denied</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n You don't have permission to view activity logs.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(basePath)}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={16} /> Back to Overview\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-6 max-w-7xl mx-auto\">\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm\">\n <div className=\"relative z-10 flex items-center gap-4\">\n <button\n onClick={() => navigate?.(basePath)}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </button>\n <div className=\"p-2.5 rounded-lg bg-primary/10\">\n <FileText size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl sm:text-3xl font-bold text-foreground\">Activity Logs</h1>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n Track integration activity and debug issues\n </p>\n </div>\n </div>\n <div className=\"absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0\" />\n </div>\n\n {/* Search & Filters */}\n <div className=\"space-y-4\">\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <div className=\"flex-1 relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"text\"\n aria-label=\"Search activity logs\"\n placeholder=\"Search logs...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <button\n onClick={() => setShowFilters(!showFilters)}\n aria-expanded={showFilters}\n className={cn(\n 'inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-all',\n showFilters || hasActiveFilters\n ? 'bg-primary text-primary-foreground border-primary'\n : 'bg-background text-foreground border-border hover:bg-accent'\n )}\n >\n <Filter size={16} /> Filter\n </button>\n {canExportCsv && (\n <button\n type=\"button\"\n onClick={handleExport}\n disabled={filteredLogs.length === 0}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors disabled:opacity-50\"\n >\n <Download size={16} /> Export CSV\n </button>\n )}\n <button\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors\"\n >\n <RefreshCw size={16} /> Refresh\n </button>\n </div>\n\n {showFilters && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5 animate-in slide-in-from-top-2 duration-200\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"font-semibold text-foreground flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" /> Filters\n </h3>\n {hasActiveFilters && (\n <button\n onClick={handleClearFilters}\n className=\"text-sm text-muted-foreground hover:text-destructive flex items-center gap-1\"\n >\n <X size={14} /> Clear All\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Log Level</label>\n <select\n value={levelFilter}\n onChange={(e) => {\n setLevelFilter(e.target.value as LogLevel | 'all');\n setCurrentPage(1);\n }}\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20\"\n >\n <option value=\"all\">All Levels</option>\n {LOG_LEVEL_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Action</label>\n <select\n value={actionFilter}\n onChange={(e) => {\n setActionFilter(e.target.value as LogAction | 'all');\n setCurrentPage(1);\n }}\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20\"\n >\n <option value=\"all\">All Actions</option>\n {LOG_ACTION_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {/* Error */}\n {error && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-5 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">Error loading logs</h3>\n <p className=\"text-sm text-status-error-text mb-3\">{error.message}</p>\n <button\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} /> Try Again\n </button>\n </div>\n </div>\n )}\n\n {/* Loading */}\n {loading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {/* Logs List */}\n {!loading && !error && (\n <>\n {filteredLogs.length > 0 ? (\n <div className=\"rounded-xl border border-border/50 bg-card overflow-hidden\">\n <div className=\"divide-y divide-border/50\">\n {filteredLogs.map((log: IntegrationLog) => (\n <div\n key={log.id}\n className=\"flex items-start gap-3 px-5 py-3.5 hover:bg-accent/30 transition-colors\"\n >\n <div className=\"mt-0.5\">{getLogLevelIcon(log.level)}</div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span\n className={cn(\n 'text-xs px-2 py-0.5 rounded-full border font-medium',\n getLogLevelColor(log.level)\n )}\n >\n {log.level.toUpperCase()}\n </span>\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground\">\n {log.action.replace(/_/g, ' ')}\n </span>\n {log.responseStatus && (\n <span\n className={cn(\n 'text-xs px-2 py-0.5 rounded-full border font-mono',\n log.responseStatus >= 400\n ? 'text-status-error-text bg-status-error-bg-subtle border-border-default'\n : 'text-status-success-text bg-status-success-bg-subtle border-border-default'\n )}\n >\n {log.responseStatus}\n </span>\n )}\n </div>\n <p className=\"text-sm text-foreground mt-1\">{log.message}</p>\n {log.requestUrl && (\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5 truncate\">\n {log.requestMethod && (\n <span className=\"font-semibold\">{log.requestMethod} </span>\n )}\n {log.requestUrl}\n </p>\n )}\n </div>\n <span className=\"text-xs text-muted-foreground whitespace-nowrap flex-shrink-0\">\n {formatDate(log.createdAt)}\n </span>\n </div>\n ))}\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-full bg-muted/50 mb-4\">\n <FileText size={32} className=\"text-muted-foreground\" />\n </div>\n <h3 className=\"font-semibold text-foreground mb-1\">\n {hasActiveFilters ? 'No matching logs' : 'No activity logs yet'}\n </h3>\n <p className=\"text-sm text-muted-foreground max-w-sm\">\n {hasActiveFilters\n ? 'Try adjusting your filters.'\n : 'Activity logs will appear here once you start using integrations.'}\n </p>\n {hasActiveFilters && (\n <button\n onClick={handleClearFilters}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <X size={14} /> Clear Filters\n </button>\n )}\n </div>\n )}\n\n {/* Pagination */}\n {totalPages > 1 && (\n <div className=\"flex items-center justify-between px-2\">\n <p className=\"text-sm text-muted-foreground\">\n Showing {(currentPage - 1) * DEFAULT_PAGE_SIZE + 1}-\n {Math.min(currentPage * DEFAULT_PAGE_SIZE, total ?? 0)} of {total}\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n onClick={() => setCurrentPage((p) => Math.max(1, p - 1))}\n disabled={currentPage === 1}\n aria-label=\"Previous page\"\n className=\"p-2 rounded-lg border border-border hover:bg-accent disabled:opacity-50 transition-colors\"\n >\n <ChevronLeft size={16} />\n </button>\n <span className=\"text-sm text-foreground px-3 py-1.5 rounded-lg bg-muted\">\n {currentPage} / {totalPages}\n </span>\n <button\n onClick={() => setCurrentPage((p) => Math.min(totalPages, p + 1))}\n disabled={currentPage === totalPages}\n aria-label=\"Next page\"\n className=\"p-2 rounded-lg border border-border hover:bg-accent disabled:opacity-50 transition-colors\"\n >\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,SAAS,EAAgB,GAAiB;AACxC,SAAQ,GAAR;EACE,KAAK,QACH,QAAO,kBAAC,GAAD;GAAa,MAAM;GAAI,WAAU;GAA2B,CAAA;EACrE,KAAK,OACH,QAAO,kBAAC,GAAD;GAAe,MAAM;GAAI,WAAU;GAA6B,CAAA;EACzE,KAAK,OACH,QAAO,kBAAC,GAAD;GAAM,MAAM;GAAI,WAAU;GAA0B,CAAA;EAC7D,KAAK,QACH,QAAO,kBAAC,GAAD;GAAK,MAAM;GAAI,WAAU;GAAuB,CAAA;EACzD,QACE,QAAO,kBAAC,GAAD;GAAU,MAAM;GAAI,WAAU;GAAuB,CAAA;;;AAIlE,SAAS,EAAiB,GAAyB;AACjD,SAAQ,GAAR;EACE,KAAK,QACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,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,IAAA,IAAiC,KAAS,EAAE;MAAC;MAAK;MAC1D;QACJ,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,UAAD;OACE,eAAe,GAAgB,MAAM,KAAK,IAAI,GAAG,IAAI,EAAE,CAAC;OACxD,UAAU,MAAgB;OAC1B,cAAW;OACX,WAAU;iBAEV,kBAAC,GAAD,EAAa,MAAM,IAAM,CAAA;OAClB,CAAA;MACT,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QACG;QAAY;QAAI;QACZ;;MACP,kBAAC,UAAD;OACE,eAAe,GAAgB,MAAM,KAAK,IAAI,GAAY,IAAI,EAAE,CAAC;OACjE,UAAU,MAAgB;OAC1B,cAAW;OACX,WAAU;iBAEV,kBAAC,GAAD,EAAc,MAAM,IAAM,CAAA;OACnB,CAAA;MACL;OACF;MAEP,EAAA,CAAA;GAED;MAzRJ,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAa,MAAM;IAAI,WAAU;IAA+B,CAAA;GAChE,kBAAC,MAAD;IAAI,WAAU;cAAyC;IAAkB,CAAA;GACzE,kBAAC,KAAD;IAAG,WAAU;cAA8C;IAEvD,CAAA;GACJ,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,IAAW,EAAS;IACnC,WAAU;cAHZ,CAKE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EAAA,oBAChB;;GACL"}
|
|
1
|
+
{"version":3,"file":"ConnectionLogs.js","names":[],"sources":["../../../src/integrations/pages/ConnectionLogs.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport {\n FileText,\n Search,\n Filter,\n X,\n AlertCircle,\n RefreshCw,\n ArrowLeft,\n Loader2,\n ChevronLeft,\n ChevronRight,\n Info,\n AlertTriangle,\n Bug,\n Activity,\n Download,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useFeatureFlag } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { INTEGRATION_FEATURE_FLAGS } from '../constants/featureFlags';\nimport { formatDate } from '../utils/integrationsHelpers';\nimport { useIntegrationLogs } from '../hooks/useLogs';\nimport { LOG_LEVEL_OPTIONS, LOG_ACTION_OPTIONS, DEFAULT_PAGE_SIZE } from '../utils/constants';\nimport type { IntegrationLog, LogLevel, LogAction } from '../types';\n\nfunction getLogLevelIcon(level: LogLevel) {\n switch (level) {\n case 'error':\n return <AlertCircle size={14} className=\"text-status-error-text\" />;\n case 'warn':\n return <AlertTriangle size={14} className=\"text-status-warning-text\" />;\n case 'info':\n return <Info size={14} className=\"text-status-info-text\" />;\n case 'debug':\n return <Bug size={14} className=\"text-text-tertiary\" />;\n default:\n return <Activity size={14} className=\"text-text-tertiary\" />;\n }\n}\n\nfunction getLogLevelColor(level: LogLevel): string {\n switch (level) {\n case 'error':\n return 'text-status-error-text bg-status-error-bg-subtle border-border-default';\n case 'warn':\n return 'text-status-warning-text bg-status-warning-bg-subtle border-border-default';\n case 'info':\n return 'text-status-info-text bg-status-info-bg-subtle border-border-default';\n case 'debug':\n return 'text-text-secondary bg-bg-sunken border-border-subtle';\n default:\n return 'text-text-secondary bg-bg-sunken border-border-subtle';\n }\n}\n\nfunction toCsvCell(value: string | number | null): string {\n const text = String(value ?? '');\n return `\"${text.replaceAll('\"', '\"\"')}\"`;\n}\n\nfunction downloadLogsCsv(logs: IntegrationLog[]) {\n const header = [\n 'Created At',\n 'Level',\n 'Action',\n 'Message',\n 'Request Method',\n 'Request URL',\n 'Status',\n ];\n const rows = logs.map((log) => [\n log.createdAt,\n log.level,\n log.action,\n log.message,\n log.requestMethod,\n log.requestUrl,\n log.responseStatus,\n ]);\n const csv = [header, ...rows].map((row) => row.map(toCsvCell).join(',')).join('\\n');\n const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = `integration-logs-${new Date().toISOString().slice(0, 10)}.csv`;\n link.click();\n URL.revokeObjectURL(url);\n}\n\n/**\n * Connection Logs — activity log view with filtering and pagination.\n */\nexport function ConnectionLogs() {\n const { basePath = '/', navigate } = useIntegrations();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canReadLogs = hasPermission(INTEGRATION_PERMISSIONS.LOG_READ);\n const canExportCsv = useFeatureFlag(INTEGRATION_FEATURE_FLAGS.CSV_EXPORT, true);\n\n const [searchQuery, setSearchQuery] = useState('');\n const [levelFilter, setLevelFilter] = useState<LogLevel | 'all'>('all');\n const [actionFilter, setActionFilter] = useState<LogAction | 'all'>('all');\n const [showFilters, setShowFilters] = useState(false);\n const [currentPage, setCurrentPage] = useState(1);\n\n const { logs, total, loading, error, refetch } = useIntegrationLogs({\n level: levelFilter === 'all' ? undefined : levelFilter,\n action: actionFilter === 'all' ? undefined : actionFilter,\n page: currentPage,\n pageSize: DEFAULT_PAGE_SIZE,\n skip: permissionsLoading || !canReadLogs,\n });\n\n // Client-side search filter\n const filteredLogs = useMemo(() => {\n if (!searchQuery) return logs ?? [];\n const q = searchQuery.toLowerCase();\n return (logs ?? []).filter(\n (log: IntegrationLog) =>\n log.message.toLowerCase().includes(q) ||\n (log.requestUrl?.toLowerCase().includes(q) ?? false)\n );\n }, [logs, searchQuery]);\n\n const totalPages = Math.ceil((total ?? 0) / DEFAULT_PAGE_SIZE);\n\n const hasActiveFilters = searchQuery || levelFilter !== 'all' || actionFilter !== 'all';\n\n const handleClearFilters = () => {\n setSearchQuery('');\n setLevelFilter('all');\n setActionFilter('all');\n setCurrentPage(1);\n };\n\n const handleExport = () => {\n downloadLogsCsv(filteredLogs);\n };\n\n if (permissionsLoading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n </div>\n );\n }\n\n if (!canReadLogs) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-center p-6\">\n <AlertCircle size={48} className=\"text-muted-foreground mb-4\" />\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Access Denied</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n You don't have permission to view activity logs.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(basePath)}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={16} /> Back to Overview\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-6 max-w-7xl mx-auto\">\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm\">\n <div className=\"relative z-10 flex items-center gap-4\">\n <button type=\"button\"\n onClick={() => navigate?.(basePath)}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </button>\n <div className=\"p-2.5 rounded-lg bg-primary/10\">\n <FileText size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl sm:text-3xl font-bold text-foreground\">Activity Logs</h1>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n Track integration activity and debug issues\n </p>\n </div>\n </div>\n <div className=\"absolute top-0 right-0 size-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0\" />\n </div>\n\n {/* Search & Filters */}\n <div className=\"space-y-4\">\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <div className=\"flex-1 relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"text\"\n aria-label=\"Search activity logs\"\n placeholder=\"Search logs...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <button type=\"button\"\n onClick={() => setShowFilters(!showFilters)}\n aria-expanded={showFilters}\n className={cn(\n 'inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-all',\n showFilters || hasActiveFilters\n ? 'bg-primary text-primary-foreground border-primary'\n : 'bg-background text-foreground border-border hover:bg-accent'\n )}\n >\n <Filter size={16} /> Filter\n </button>\n {canExportCsv && (\n <button\n type=\"button\"\n onClick={handleExport}\n disabled={filteredLogs.length === 0}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors disabled:opacity-50\"\n >\n <Download size={16} /> Export CSV\n </button>\n )}\n <button type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors\"\n >\n <RefreshCw size={16} /> Refresh\n </button>\n </div>\n\n {showFilters && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5 animate-in slide-in-from-top-2 duration-200\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"font-semibold text-foreground flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" /> Filters\n </h3>\n {hasActiveFilters && (\n <button type=\"button\"\n onClick={handleClearFilters}\n className=\"text-sm text-muted-foreground hover:text-destructive flex items-center gap-1\"\n >\n <X size={14} /> Clear All\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Log Level</label>\n <select\n value={levelFilter}\n onChange={(e) => {\n setLevelFilter(e.target.value as LogLevel | 'all');\n setCurrentPage(1);\n }}\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20\"\n >\n <option value=\"all\">All Levels</option>\n {LOG_LEVEL_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Action</label>\n <select\n value={actionFilter}\n onChange={(e) => {\n setActionFilter(e.target.value as LogAction | 'all');\n setCurrentPage(1);\n }}\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20\"\n >\n <option value=\"all\">All Actions</option>\n {LOG_ACTION_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {/* Error */}\n {error && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-5 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">Error loading logs</h3>\n <p className=\"text-sm text-status-error-text mb-3\">{error.message}</p>\n <button type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} /> Try Again\n </button>\n </div>\n </div>\n )}\n\n {/* Loading */}\n {loading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {/* Logs List */}\n {!loading && !error && (\n <>\n {filteredLogs.length > 0 ? (\n <div className=\"rounded-xl border border-border/50 bg-card overflow-hidden\">\n <div className=\"divide-y divide-border/50\">\n {filteredLogs.map((log: IntegrationLog) => (\n <div\n key={log.id}\n className=\"flex items-start gap-3 px-5 py-3.5 hover:bg-accent/30 transition-colors\"\n >\n <div className=\"mt-0.5\">{getLogLevelIcon(log.level)}</div>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span\n className={cn(\n 'text-xs px-2 py-0.5 rounded-full border font-medium',\n getLogLevelColor(log.level)\n )}\n >\n {log.level.toUpperCase()}\n </span>\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground\">\n {log.action.replace(/_/g, ' ')}\n </span>\n {log.responseStatus && (\n <span\n className={cn(\n 'text-xs px-2 py-0.5 rounded-full border font-mono',\n log.responseStatus >= 400\n ? 'text-status-error-text bg-status-error-bg-subtle border-border-default'\n : 'text-status-success-text bg-status-success-bg-subtle border-border-default'\n )}\n >\n {log.responseStatus}\n </span>\n )}\n </div>\n <p className=\"text-sm text-foreground mt-1\">{log.message}</p>\n {log.requestUrl && (\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5 truncate\">\n {log.requestMethod && (\n <span className=\"font-semibold\">{log.requestMethod} </span>\n )}\n {log.requestUrl}\n </p>\n )}\n </div>\n <span className=\"text-xs text-muted-foreground whitespace-nowrap flex-shrink-0\">\n {formatDate(log.createdAt)}\n </span>\n </div>\n ))}\n </div>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-full bg-muted/50 mb-4\">\n <FileText size={32} className=\"text-muted-foreground\" />\n </div>\n <h3 className=\"font-semibold text-foreground mb-1\">\n {hasActiveFilters ? 'No matching logs' : 'No activity logs yet'}\n </h3>\n <p className=\"text-sm text-muted-foreground max-w-sm\">\n {hasActiveFilters\n ? 'Try adjusting your filters.'\n : 'Activity logs will appear here once you start using integrations.'}\n </p>\n {hasActiveFilters && (\n <button type=\"button\"\n onClick={handleClearFilters}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <X size={14} /> Clear Filters\n </button>\n )}\n </div>\n )}\n\n {/* Pagination */}\n {totalPages > 1 && (\n <div className=\"flex items-center justify-between px-2\">\n <p className=\"text-sm text-muted-foreground\">\n Showing {(currentPage - 1) * DEFAULT_PAGE_SIZE + 1}-\n {Math.min(currentPage * DEFAULT_PAGE_SIZE, total ?? 0)} of {total}\n </p>\n <div className=\"flex items-center gap-2\">\n <button type=\"button\"\n onClick={() => setCurrentPage((p) => Math.max(1, p - 1))}\n disabled={currentPage === 1}\n aria-label=\"Previous page\"\n className=\"p-2 rounded-lg border border-border hover:bg-accent disabled:opacity-50 transition-colors\"\n >\n <ChevronLeft size={16} />\n </button>\n <span className=\"text-sm text-foreground px-3 py-1.5 rounded-lg bg-muted\">\n {currentPage} / {totalPages}\n </span>\n <button type=\"button\"\n onClick={() => setCurrentPage((p) => Math.min(totalPages, p + 1))}\n disabled={currentPage === totalPages}\n aria-label=\"Next page\"\n className=\"p-2 rounded-lg border border-border hover:bg-accent disabled:opacity-50 transition-colors\"\n >\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,SAAS,EAAgB,GAAiB;AACxC,SAAQ,GAAR;EACE,KAAK,QACH,QAAO,kBAAC,GAAD;GAAa,MAAM;GAAI,WAAU;GAA2B,CAAA;EACrE,KAAK,OACH,QAAO,kBAAC,GAAD;GAAe,MAAM;GAAI,WAAU;GAA6B,CAAA;EACzE,KAAK,OACH,QAAO,kBAAC,GAAD;GAAM,MAAM;GAAI,WAAU;GAA0B,CAAA;EAC7D,KAAK,QACH,QAAO,kBAAC,GAAD;GAAK,MAAM;GAAI,WAAU;GAAuB,CAAA;EACzD,QACE,QAAO,kBAAC,GAAD;GAAU,MAAM;GAAI,WAAU;GAAuB,CAAA;;;AAIlE,SAAS,EAAiB,GAAyB;AACjD,SAAQ,GAAR;EACE,KAAK,QACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,QACE,QAAO;;;AAIb,SAAS,EAAU,GAAuC;AAExD,QAAO,IADM,OAAO,KAAS,GAAG,CAChB,WAAW,MAAK,OAAK,CAAC;;AAGxC,SAAS,EAAgB,GAAwB;CAmB/C,IAAM,IAAM,CAlBG;EACb;EACA;EACA;EACA;EACA;EACA;EACA;EACD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,eAAe,GAAgB,MAAM,KAAK,IAAI,GAAG,IAAI,EAAE,CAAC;OACxD,UAAU,MAAgB;OAC1B,cAAW;OACX,WAAU;iBAEV,kBAAC,GAAD,EAAa,MAAM,IAAM,CAAA;OAClB,CAAA;MACT,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QACG;QAAY;QAAI;QACZ;;MACP,kBAAC,UAAD;OAAQ,MAAK;OACX,eAAe,GAAgB,MAAM,KAAK,IAAI,GAAY,IAAI,EAAE,CAAC;OACjE,UAAU,MAAgB;OAC1B,cAAW;OACX,WAAU;iBAEV,kBAAC,GAAD,EAAc,MAAM,IAAM,CAAA;OACnB,CAAA;MACL;OACF;MAEP,EAAA,CAAA;GAED;MAzRJ,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAa,MAAM;IAAI,WAAU;IAA+B,CAAA;GAChE,kBAAC,MAAD;IAAI,WAAU;cAAyC;IAAkB,CAAA;GACzE,kBAAC,KAAD;IAAG,WAAU;cAA8C;IAEvD,CAAA;GACJ,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,IAAW,EAAS;IACnC,WAAU;cAHZ,CAKE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EAAA,oBAChB;;GACL"}
|
|
@@ -41,6 +41,7 @@ function E() {
|
|
|
41
41
|
className: "flex items-center gap-4",
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ w("button", {
|
|
44
|
+
type: "button",
|
|
44
45
|
onClick: () => D?.(E),
|
|
45
46
|
className: "p-2.5 hover:bg-accent rounded-lg transition-all duration-200",
|
|
46
47
|
"aria-label": "Back to overview",
|
|
@@ -62,11 +63,12 @@ function E() {
|
|
|
62
63
|
})] })
|
|
63
64
|
]
|
|
64
65
|
}), H && /* @__PURE__ */ T("button", {
|
|
66
|
+
type: "button",
|
|
65
67
|
onClick: () => P(),
|
|
66
68
|
className: "inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",
|
|
67
69
|
children: [/* @__PURE__ */ w(v, { size: 16 }), "Add Connection"]
|
|
68
70
|
})]
|
|
69
|
-
}), /* @__PURE__ */ w("div", { className: "absolute top-0 right-0
|
|
71
|
+
}), /* @__PURE__ */ w("div", { className: "absolute top-0 right-0 size-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0" })]
|
|
70
72
|
}),
|
|
71
73
|
/* @__PURE__ */ T("div", {
|
|
72
74
|
className: "space-y-4",
|
|
@@ -88,6 +90,7 @@ function E() {
|
|
|
88
90
|
})]
|
|
89
91
|
}),
|
|
90
92
|
/* @__PURE__ */ T("button", {
|
|
93
|
+
type: "button",
|
|
91
94
|
onClick: () => W(!U),
|
|
92
95
|
className: t("inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-all", U || K ? "bg-primary text-primary-foreground border-primary" : "bg-background text-foreground border-border hover:bg-accent"),
|
|
93
96
|
children: [/* @__PURE__ */ w(m, { size: 16 }), "Filter"]
|
|
@@ -95,11 +98,13 @@ function E() {
|
|
|
95
98
|
/* @__PURE__ */ T("div", {
|
|
96
99
|
className: "flex items-center border border-border rounded-lg overflow-hidden",
|
|
97
100
|
children: [/* @__PURE__ */ w("button", {
|
|
101
|
+
type: "button",
|
|
98
102
|
onClick: () => A("grid"),
|
|
99
103
|
className: t("p-2.5 transition-colors", k === "grid" ? "bg-primary text-primary-foreground" : "hover:bg-accent"),
|
|
100
104
|
"aria-label": "Grid view",
|
|
101
105
|
children: /* @__PURE__ */ w(h, { size: 16 })
|
|
102
106
|
}), /* @__PURE__ */ w("button", {
|
|
107
|
+
type: "button",
|
|
103
108
|
onClick: () => A("list"),
|
|
104
109
|
className: t("p-2.5 transition-colors", k === "list" ? "bg-primary text-primary-foreground" : "hover:bg-accent"),
|
|
105
110
|
"aria-label": "List view",
|
|
@@ -118,6 +123,7 @@ function E() {
|
|
|
118
123
|
className: "text-primary"
|
|
119
124
|
}), "Filters"]
|
|
120
125
|
}), K && /* @__PURE__ */ T("button", {
|
|
126
|
+
type: "button",
|
|
121
127
|
onClick: q,
|
|
122
128
|
className: "text-sm text-muted-foreground hover:text-destructive transition-colors flex items-center gap-1",
|
|
123
129
|
children: [/* @__PURE__ */ w(x, { size: 14 }), " Clear All"]
|
|
@@ -179,6 +185,7 @@ function E() {
|
|
|
179
185
|
children: R.message
|
|
180
186
|
}),
|
|
181
187
|
/* @__PURE__ */ T("button", {
|
|
188
|
+
type: "button",
|
|
182
189
|
onClick: () => z(),
|
|
183
190
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors",
|
|
184
191
|
children: [/* @__PURE__ */ w(y, { size: 14 }), " Try Again"]
|
|
@@ -199,7 +206,7 @@ function E() {
|
|
|
199
206
|
className: "rounded-xl border border-border/50 bg-card p-5 animate-pulse",
|
|
200
207
|
children: /* @__PURE__ */ T("div", {
|
|
201
208
|
className: "flex items-start gap-3",
|
|
202
|
-
children: [/* @__PURE__ */ w("div", { className: "
|
|
209
|
+
children: [/* @__PURE__ */ w("div", { className: "size-11 bg-muted rounded-xl" }), /* @__PURE__ */ T("div", {
|
|
203
210
|
className: "flex-1 space-y-2",
|
|
204
211
|
children: [/* @__PURE__ */ w("div", { className: "h-4 w-3/4 bg-muted rounded" }), /* @__PURE__ */ w("div", { className: "h-3 w-1/2 bg-muted rounded" })]
|
|
205
212
|
})]
|
|
@@ -232,10 +239,12 @@ function E() {
|
|
|
232
239
|
children: K ? "Try adjusting your search or filters." : H ? "Add a connection to start integrating with external services." : "No connections are configured yet. Contact your workspace admin to add one."
|
|
233
240
|
}),
|
|
234
241
|
K ? /* @__PURE__ */ T("button", {
|
|
242
|
+
type: "button",
|
|
235
243
|
onClick: q,
|
|
236
244
|
className: "mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
237
245
|
children: [/* @__PURE__ */ w(x, { size: 14 }), " Clear Filters"]
|
|
238
246
|
}) : H && /* @__PURE__ */ T("button", {
|
|
247
|
+
type: "button",
|
|
239
248
|
onClick: () => P(),
|
|
240
249
|
className: "mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",
|
|
241
250
|
children: [/* @__PURE__ */ w(v, { size: 14 }), " Add Connection"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionsList.js","names":[],"sources":["../../../src/integrations/pages/ConnectionsList.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport {\n Search,\n Filter,\n X,\n Grid3x3,\n List,\n Plus,\n Link2,\n AlertCircle,\n RefreshCw,\n ArrowLeft,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsStore } from '../store/integrationsStore';\nimport { useConnections } from '../hooks/useConnections';\nimport { joinPath } from '../utils/navigation';\nimport { ConnectionCard } from '../components/ConnectionCard';\nimport { AddConnectionDialog } from '../components/AddConnectionDialog';\nimport { CONNECTION_STATUS_OPTIONS, PROVIDER_CATEGORIES } from '../utils/constants';\nimport type { IntegrationConnection, ConnectionStatus, ProviderCategory } from '../types';\n\n/**\n * Connections List — list of all connections with search and status filter.\n */\nexport function ConnectionsList() {\n const { basePath = '/', navigate, onConnectionSelect } = useIntegrations();\n const {\n viewMode,\n setViewMode,\n connectionFilter,\n updateConnectionFilter,\n addConnectionDialogOpen,\n openAddConnectionDialog,\n closeAddConnectionDialog,\n } = useIntegrationsStore();\n\n const { connections, loading, error, refetch } = useConnections();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const [showFilters, setShowFilters] = useState(false);\n\n const filteredConnections = useMemo(() => {\n let result = connections ?? [];\n\n if (connectionFilter.search) {\n const q = connectionFilter.search.toLowerCase();\n result = result.filter(\n (c: IntegrationConnection) =>\n c.name.toLowerCase().includes(q) ||\n c.provider.name.toLowerCase().includes(q) ||\n (c.externalAccountEmail?.toLowerCase().includes(q) ?? false)\n );\n }\n\n if (connectionFilter.status !== 'all') {\n result = result.filter((c: IntegrationConnection) => c.status === connectionFilter.status);\n }\n\n if (connectionFilter.providerId) {\n result = result.filter(\n (c: IntegrationConnection) => c.provider.id === connectionFilter.providerId\n );\n }\n\n if (connectionFilter.category !== 'all') {\n result = result.filter(\n (c: IntegrationConnection) => c.provider.category === connectionFilter.category\n );\n }\n\n return result.sort(\n (a: IntegrationConnection, b: IntegrationConnection) =>\n new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()\n );\n }, [connections, connectionFilter]);\n\n const hasActiveFilters =\n connectionFilter.search ||\n connectionFilter.status !== 'all' ||\n connectionFilter.providerId ||\n connectionFilter.category !== 'all';\n\n const handleClearFilters = () => {\n updateConnectionFilter({ search: '', status: 'all', providerId: null, category: 'all' });\n };\n\n const handleConnectionClick = (connection: IntegrationConnection) => {\n onConnectionSelect?.(connection);\n navigate?.(joinPath(basePath, `connections/${connection.id}`));\n };\n\n return (\n <div className=\"space-y-6 p-6 max-w-7xl mx-auto\">\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm\">\n <div className=\"relative z-10 flex items-center justify-between\">\n <div className=\"flex items-center gap-4\">\n <button\n onClick={() => navigate?.(basePath)}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all duration-200\"\n aria-label=\"Back to overview\"\n >\n <ArrowLeft size={20} />\n </button>\n <div className=\"p-2.5 rounded-lg bg-primary/10 backdrop-blur-sm\">\n <Link2 size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl sm:text-3xl font-bold text-foreground\">Connections</h1>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n Manage your integration connections\n </p>\n </div>\n </div>\n {canCreate && (\n <button\n onClick={() => openAddConnectionDialog()}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Plus size={16} />\n Add Connection\n </button>\n )}\n </div>\n <div className=\"absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0\" />\n </div>\n\n {/* Search & Filters */}\n <div className=\"space-y-4\">\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <div className=\"flex-1 relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground group-focus-within:text-primary transition-colors\"\n />\n <input\n type=\"text\"\n placeholder=\"Search connections...\"\n value={connectionFilter.search}\n onChange={(e) => updateConnectionFilter({ search: e.target.value })}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n aria-label=\"Search connections\"\n />\n </div>\n\n <button\n onClick={() => setShowFilters(!showFilters)}\n className={cn(\n 'inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-all',\n showFilters || hasActiveFilters\n ? 'bg-primary text-primary-foreground border-primary'\n : 'bg-background text-foreground border-border hover:bg-accent'\n )}\n >\n <Filter size={16} />\n Filter\n </button>\n\n <div className=\"flex items-center border border-border rounded-lg overflow-hidden\">\n <button\n onClick={() => setViewMode('grid')}\n className={cn(\n 'p-2.5 transition-colors',\n viewMode === 'grid' ? 'bg-primary text-primary-foreground' : 'hover:bg-accent'\n )}\n aria-label=\"Grid view\"\n >\n <Grid3x3 size={16} />\n </button>\n <button\n onClick={() => setViewMode('list')}\n className={cn(\n 'p-2.5 transition-colors',\n viewMode === 'list' ? 'bg-primary text-primary-foreground' : 'hover:bg-accent'\n )}\n aria-label=\"List view\"\n >\n <List size={16} />\n </button>\n </div>\n </div>\n\n {showFilters && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5 animate-in slide-in-from-top-2 duration-200\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"font-semibold text-foreground flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" />\n Filters\n </h3>\n {hasActiveFilters && (\n <button\n onClick={handleClearFilters}\n className=\"text-sm text-muted-foreground hover:text-destructive transition-colors flex items-center gap-1\"\n >\n <X size={14} /> Clear All\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Status</label>\n <select\n value={connectionFilter.status}\n onChange={(e) =>\n updateConnectionFilter({ status: e.target.value as ConnectionStatus | 'all' })\n }\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n <option value=\"all\">All Statuses</option>\n {CONNECTION_STATUS_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Category</label>\n <select\n value={connectionFilter.category}\n onChange={(e) =>\n updateConnectionFilter({ category: e.target.value as ProviderCategory | 'all' })\n }\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n <option value=\"all\">All Categories</option>\n {PROVIDER_CATEGORIES.map((cat) => (\n <option key={cat.value} value={cat.value}>\n {cat.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {/* Error */}\n {error && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-5 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text flex-shrink-0\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">Error loading connections</h3>\n <p className=\"text-sm text-status-error-text mb-3\">{error.message}</p>\n <button\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} /> Try Again\n </button>\n </div>\n </div>\n )}\n\n {/* Loading */}\n {loading && (\n <div\n className={cn(\n viewMode === 'grid'\n ? 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4'\n : 'space-y-3'\n )}\n >\n {[...Array(6)].map((_, i) => (\n <div key={i} className=\"rounded-xl border border-border/50 bg-card p-5 animate-pulse\">\n <div className=\"flex items-start gap-3\">\n <div className=\"w-11 h-11 bg-muted rounded-xl\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 w-3/4 bg-muted rounded\" />\n <div className=\"h-3 w-1/2 bg-muted rounded\" />\n </div>\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Connections */}\n {!loading && !error && (\n <>\n {filteredConnections.length > 0 ? (\n <div\n className={cn(\n viewMode === 'grid'\n ? 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4'\n : 'space-y-3'\n )}\n >\n {filteredConnections.map((conn: IntegrationConnection) => (\n <ConnectionCard\n key={conn.id}\n connection={conn}\n displayMode={viewMode}\n onClick={handleConnectionClick}\n />\n ))}\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-full bg-muted/50 mb-4\">\n {hasActiveFilters ? (\n <Search size={32} className=\"text-muted-foreground\" />\n ) : (\n <Link2 size={32} className=\"text-muted-foreground\" />\n )}\n </div>\n <h3 className=\"font-semibold text-foreground mb-1\">\n {hasActiveFilters ? 'No matching connections' : 'No connections yet'}\n </h3>\n <p className=\"text-sm text-muted-foreground max-w-sm\">\n {hasActiveFilters\n ? 'Try adjusting your search or filters.'\n : canCreate\n ? 'Add a connection to start integrating with external services.'\n : 'No connections are configured yet. Contact your workspace admin to add one.'}\n </p>\n {hasActiveFilters ? (\n <button\n onClick={handleClearFilters}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <X size={14} /> Clear Filters\n </button>\n ) : (\n canCreate && (\n <button\n onClick={() => openAddConnectionDialog()}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Plus size={14} /> Add Connection\n </button>\n )\n )}\n </div>\n )}\n </>\n )}\n {/* Add Connection Dialog */}\n <AddConnectionDialog\n open={addConnectionDialogOpen}\n onClose={closeAddConnectionDialog}\n onConnectionCreated={() => {\n refetch();\n }}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA4BA,SAAgB,IAAkB;CAChC,IAAM,EAAE,cAAW,KAAK,aAAU,0BAAuB,GAAiB,EACpE,EACJ,aACA,gBACA,qBACA,2BACA,4BACA,4BACA,gCACE,GAAsB,EAEpB,EAAE,gBAAa,YAAS,UAAO,eAAY,GAAgB,EAC3D,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,IAAY,CAAC,KAAsB,EAAc,EAAwB,kBAAkB,EAC3F,CAAC,GAAa,KAAkB,EAAS,GAAM,EAE/C,IAAsB,QAAc;EACxC,IAAI,IAAS,KAAe,EAAE;AAE9B,MAAI,EAAiB,QAAQ;GAC3B,IAAM,IAAI,EAAiB,OAAO,aAAa;AAC/C,OAAS,EAAO,QACb,MACC,EAAE,KAAK,aAAa,CAAC,SAAS,EAAE,IAChC,EAAE,SAAS,KAAK,aAAa,CAAC,SAAS,EAAE,KACxC,EAAE,sBAAsB,aAAa,CAAC,SAAS,EAAE,IAAI,IACzD;;AAmBH,SAhBI,EAAiB,WAAW,UAC9B,IAAS,EAAO,QAAQ,M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pages/ConnectionsList.tsx"],"sourcesContent":["import { useState, useMemo } from 'react';\nimport {\n Search,\n Filter,\n X,\n Grid3x3,\n List,\n Plus,\n Link2,\n AlertCircle,\n RefreshCw,\n ArrowLeft,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsStore } from '../store/integrationsStore';\nimport { useConnections } from '../hooks/useConnections';\nimport { joinPath } from '../utils/navigation';\nimport { ConnectionCard } from '../components/ConnectionCard';\nimport { AddConnectionDialog } from '../components/AddConnectionDialog';\nimport { CONNECTION_STATUS_OPTIONS, PROVIDER_CATEGORIES } from '../utils/constants';\nimport type { IntegrationConnection, ConnectionStatus, ProviderCategory } from '../types';\n\n/**\n * Connections List — list of all connections with search and status filter.\n */\nexport function ConnectionsList() {\n const { basePath = '/', navigate, onConnectionSelect } = useIntegrations();\n const {\n viewMode,\n setViewMode,\n connectionFilter,\n updateConnectionFilter,\n addConnectionDialogOpen,\n openAddConnectionDialog,\n closeAddConnectionDialog,\n } = useIntegrationsStore();\n\n const { connections, loading, error, refetch } = useConnections();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const [showFilters, setShowFilters] = useState(false);\n\n const filteredConnections = useMemo(() => {\n let result = connections ?? [];\n\n if (connectionFilter.search) {\n const q = connectionFilter.search.toLowerCase();\n result = result.filter(\n (c: IntegrationConnection) =>\n c.name.toLowerCase().includes(q) ||\n c.provider.name.toLowerCase().includes(q) ||\n (c.externalAccountEmail?.toLowerCase().includes(q) ?? false)\n );\n }\n\n if (connectionFilter.status !== 'all') {\n result = result.filter((c: IntegrationConnection) => c.status === connectionFilter.status);\n }\n\n if (connectionFilter.providerId) {\n result = result.filter(\n (c: IntegrationConnection) => c.provider.id === connectionFilter.providerId\n );\n }\n\n if (connectionFilter.category !== 'all') {\n result = result.filter(\n (c: IntegrationConnection) => c.provider.category === connectionFilter.category\n );\n }\n\n return result.sort(\n (a: IntegrationConnection, b: IntegrationConnection) =>\n new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()\n );\n }, [connections, connectionFilter]);\n\n const hasActiveFilters =\n connectionFilter.search ||\n connectionFilter.status !== 'all' ||\n connectionFilter.providerId ||\n connectionFilter.category !== 'all';\n\n const handleClearFilters = () => {\n updateConnectionFilter({ search: '', status: 'all', providerId: null, category: 'all' });\n };\n\n const handleConnectionClick = (connection: IntegrationConnection) => {\n onConnectionSelect?.(connection);\n navigate?.(joinPath(basePath, `connections/${connection.id}`));\n };\n\n return (\n <div className=\"space-y-6 p-6 max-w-7xl mx-auto\">\n {/* Header */}\n <div className=\"relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm\">\n <div className=\"relative z-10 flex items-center justify-between\">\n <div className=\"flex items-center gap-4\">\n <button type=\"button\"\n onClick={() => navigate?.(basePath)}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all duration-200\"\n aria-label=\"Back to overview\"\n >\n <ArrowLeft size={20} />\n </button>\n <div className=\"p-2.5 rounded-lg bg-primary/10 backdrop-blur-sm\">\n <Link2 size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl sm:text-3xl font-bold text-foreground\">Connections</h1>\n <p className=\"text-sm text-muted-foreground mt-0.5\">\n Manage your integration connections\n </p>\n </div>\n </div>\n {canCreate && (\n <button type=\"button\"\n onClick={() => openAddConnectionDialog()}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Plus size={16} />\n Add Connection\n </button>\n )}\n </div>\n <div className=\"absolute top-0 right-0 size-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0\" />\n </div>\n\n {/* Search & Filters */}\n <div className=\"space-y-4\">\n <div className=\"flex flex-col sm:flex-row gap-3\">\n <div className=\"flex-1 relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground group-focus-within:text-primary transition-colors\"\n />\n <input\n type=\"text\"\n placeholder=\"Search connections...\"\n value={connectionFilter.search}\n onChange={(e) => updateConnectionFilter({ search: e.target.value })}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all\"\n aria-label=\"Search connections\"\n />\n </div>\n\n <button type=\"button\"\n onClick={() => setShowFilters(!showFilters)}\n className={cn(\n 'inline-flex items-center gap-2 px-4 py-2.5 rounded-lg border text-sm font-medium transition-all',\n showFilters || hasActiveFilters\n ? 'bg-primary text-primary-foreground border-primary'\n : 'bg-background text-foreground border-border hover:bg-accent'\n )}\n >\n <Filter size={16} />\n Filter\n </button>\n\n <div className=\"flex items-center border border-border rounded-lg overflow-hidden\">\n <button type=\"button\"\n onClick={() => setViewMode('grid')}\n className={cn(\n 'p-2.5 transition-colors',\n viewMode === 'grid' ? 'bg-primary text-primary-foreground' : 'hover:bg-accent'\n )}\n aria-label=\"Grid view\"\n >\n <Grid3x3 size={16} />\n </button>\n <button type=\"button\"\n onClick={() => setViewMode('list')}\n className={cn(\n 'p-2.5 transition-colors',\n viewMode === 'list' ? 'bg-primary text-primary-foreground' : 'hover:bg-accent'\n )}\n aria-label=\"List view\"\n >\n <List size={16} />\n </button>\n </div>\n </div>\n\n {showFilters && (\n <div className=\"rounded-xl border border-border/50 bg-card p-5 animate-in slide-in-from-top-2 duration-200\">\n <div className=\"flex items-center justify-between mb-4\">\n <h3 className=\"font-semibold text-foreground flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" />\n Filters\n </h3>\n {hasActiveFilters && (\n <button type=\"button\"\n onClick={handleClearFilters}\n className=\"text-sm text-muted-foreground hover:text-destructive transition-colors flex items-center gap-1\"\n >\n <X size={14} /> Clear All\n </button>\n )}\n </div>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Status</label>\n <select\n value={connectionFilter.status}\n onChange={(e) =>\n updateConnectionFilter({ status: e.target.value as ConnectionStatus | 'all' })\n }\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n <option value=\"all\">All Statuses</option>\n {CONNECTION_STATUS_OPTIONS.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n <div className=\"space-y-2\">\n <label className=\"block text-sm font-medium text-foreground\">Category</label>\n <select\n value={connectionFilter.category}\n onChange={(e) =>\n updateConnectionFilter({ category: e.target.value as ProviderCategory | 'all' })\n }\n className=\"w-full px-3 py-2 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n <option value=\"all\">All Categories</option>\n {PROVIDER_CATEGORIES.map((cat) => (\n <option key={cat.value} value={cat.value}>\n {cat.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {/* Error */}\n {error && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-5 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text flex-shrink-0\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">Error loading connections</h3>\n <p className=\"text-sm text-status-error-text mb-3\">{error.message}</p>\n <button type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} /> Try Again\n </button>\n </div>\n </div>\n )}\n\n {/* Loading */}\n {loading && (\n <div\n className={cn(\n viewMode === 'grid'\n ? 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4'\n : 'space-y-3'\n )}\n >\n {[...Array(6)].map((_, i) => (\n <div key={i} className=\"rounded-xl border border-border/50 bg-card p-5 animate-pulse\">\n <div className=\"flex items-start gap-3\">\n <div className=\"size-11 bg-muted rounded-xl\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 w-3/4 bg-muted rounded\" />\n <div className=\"h-3 w-1/2 bg-muted rounded\" />\n </div>\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Connections */}\n {!loading && !error && (\n <>\n {filteredConnections.length > 0 ? (\n <div\n className={cn(\n viewMode === 'grid'\n ? 'grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4'\n : 'space-y-3'\n )}\n >\n {filteredConnections.map((conn: IntegrationConnection) => (\n <ConnectionCard\n key={conn.id}\n connection={conn}\n displayMode={viewMode}\n onClick={handleConnectionClick}\n />\n ))}\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-full bg-muted/50 mb-4\">\n {hasActiveFilters ? (\n <Search size={32} className=\"text-muted-foreground\" />\n ) : (\n <Link2 size={32} className=\"text-muted-foreground\" />\n )}\n </div>\n <h3 className=\"font-semibold text-foreground mb-1\">\n {hasActiveFilters ? 'No matching connections' : 'No connections yet'}\n </h3>\n <p className=\"text-sm text-muted-foreground max-w-sm\">\n {hasActiveFilters\n ? 'Try adjusting your search or filters.'\n : canCreate\n ? 'Add a connection to start integrating with external services.'\n : 'No connections are configured yet. Contact your workspace admin to add one.'}\n </p>\n {hasActiveFilters ? (\n <button type=\"button\"\n onClick={handleClearFilters}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <X size={14} /> Clear Filters\n </button>\n ) : (\n canCreate && (\n <button type=\"button\"\n onClick={() => openAddConnectionDialog()}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Plus size={14} /> Add Connection\n </button>\n )\n )}\n </div>\n )}\n </>\n )}\n {/* Add Connection Dialog */}\n <AddConnectionDialog\n open={addConnectionDialogOpen}\n onClose={closeAddConnectionDialog}\n onConnectionCreated={() => {\n refetch();\n }}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA4BA,SAAgB,IAAkB;CAChC,IAAM,EAAE,cAAW,KAAK,aAAU,0BAAuB,GAAiB,EACpE,EACJ,aACA,gBACA,qBACA,2BACA,4BACA,4BACA,gCACE,GAAsB,EAEpB,EAAE,gBAAa,YAAS,UAAO,eAAY,GAAgB,EAC3D,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,IAAY,CAAC,KAAsB,EAAc,EAAwB,kBAAkB,EAC3F,CAAC,GAAa,KAAkB,EAAS,GAAM,EAE/C,IAAsB,QAAc;EACxC,IAAI,IAAS,KAAe,EAAE;AAE9B,MAAI,EAAiB,QAAQ;GAC3B,IAAM,IAAI,EAAiB,OAAO,aAAa;AAC/C,OAAS,EAAO,QACb,MACC,EAAE,KAAK,aAAa,CAAC,SAAS,EAAE,IAChC,EAAE,SAAS,KAAK,aAAa,CAAC,SAAS,EAAE,KACxC,EAAE,sBAAsB,aAAa,CAAC,SAAS,EAAE,IAAI,IACzD;;AAmBH,SAhBI,EAAiB,WAAW,UAC9B,IAAS,EAAO,QAAQ,MAA6B,EAAE,WAAW,EAAiB,OAAO,GAGxF,EAAiB,eACnB,IAAS,EAAO,QACb,MAA6B,EAAE,SAAS,OAAO,EAAiB,WAClE,GAGC,EAAiB,aAAa,UAChC,IAAS,EAAO,QACb,MAA6B,EAAE,SAAS,aAAa,EAAiB,SACxE,GAGI,EAAO,MACX,GAA0B,MACzB,IAAI,KAAK,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,KAAK,EAAE,UAAU,CAAC,SAAS,CACpE;IAC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