@burdenoff/microfe-integrations 2026.625.2 → 2026.625.4
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/components/ConnectionStatusBadge.js +1 -1
- package/dist/integrations/components/ConnectionStatusBadge.js.map +1 -1
- package/dist/integrations/pages/AddConnectionWizard.js +258 -256
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +187 -152
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionLogs.js +43 -55
- package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +66 -79
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.js +101 -81
- package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
- package/dist/integrations/pages/IntegrationsSettings.js +52 -48
- package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
- package/dist/integrations/pages/ProviderCatalog.js +94 -106
- package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.js +211 -190
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/pages/ProviderEditorPage.js +147 -143
- package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -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 {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n Button,\n GlassCard,\n ShowMore,\n CTAOverflowMenu,\n type CTAAction,\n} from '@burdenoff/fe-libs/ui';\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-text-secondary\">\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 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\n 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-subtle 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-200',\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 <AlertDialog\n open={deleteDialogOpen}\n onOpenChange={(next) => {\n if (!next) {\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n }\n }}\n >\n <AlertDialogContent className=\"max-w-md\">\n <AlertDialogHeader>\n <AlertDialogTitle>Delete connection</AlertDialogTitle>\n <AlertDialogDescription>\n This removes the connection record immediately. You can also remove the mapped vault\n secret if you no longer need it.\n </AlertDialogDescription>\n </AlertDialogHeader>\n\n {usesVaultCredentials && (\n <label className=\"flex items-start gap-3 rounded-lg border border-border-subtle/60 bg-bg-surface 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 aria-label=\"Also remove mapped vault secret\"\n />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n Also remove mapped vault secret\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n Use this only if no other connections rely on the same secret.\n </p>\n </div>\n </label>\n )}\n\n <AlertDialogFooter>\n <AlertDialogCancel\n onClick={() => {\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n }}\n >\n Cancel\n </AlertDialogCancel>\n <AlertDialogAction\n disabled={deleting}\n onClick={(event) => {\n event.preventDefault();\n confirmDelete();\n }}\n className=\"inline-flex items-center gap-2 bg-status-error-bg text-action-primary-text disabled:opacity-50\"\n >\n {deleting ? <Loader2 size={14} className=\"animate-spin\" /> : <Trash2 size={14} />}\n Delete connection\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\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=\"rounded-xl border border-border-seam bg-accent-wash p-6\">\n <div className=\"flex items-center gap-4\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\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-text-primary\">\n {connection.name}\n </h1>\n <ConnectionStatusBadge status={connection.status} size=\"md\" />\n </div>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n {connection.provider.name} · {getAuthTypeLabel(connection.provider.authType)}\n </p>\n </div>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {/* Connection Info */}\n <GlassCard className=\"border-border-seam p-5 space-y-4\">\n <h2 className=\"font-semibold text-text-primary 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-seam\">\n <span className=\"text-xs text-text-secondary uppercase tracking-wide\">\n {tx('integrations.connectionDetail.fields.description', 'Description')}\n </span>\n <p className=\"text-sm text-text-primary mt-0.5\">{connection.description}</p>\n </div>\n )}\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.fields.provider', 'Provider')}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">\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-seam\">\n <span className=\"text-sm text-text-secondary 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-text-primary\">\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-seam\">\n <span className=\"text-sm text-text-secondary 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-text-primary\">\n {connection.externalAccountName}\n </span>\n </div>\n )}\n {connection.errorMessage && (\n <div className=\"py-2 border-b border-border-seam\">\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-seam\">\n <span className=\"text-sm text-text-secondary 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-text-primary\">\n {formatLastUsed(connection.lastUsedAt)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.fields.healthCheck', 'Health Check')}\n </span>\n <span className=\"text-sm text-text-primary\">\n {formatDate(connection.lastHealthCheck)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2\">\n <span className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.fields.created', 'Created')}\n </span>\n <span className=\"text-sm text-text-primary\">{formatDate(connection.createdAt)}</span>\n </div>\n </div>\n </GlassCard>\n\n {/* Scopes & Actions */}\n <div className=\"space-y-4\">\n {/* Granted Scopes */}\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary 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 <ShowMore collapsedHeight={88} label=\"Show all scopes\">\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-bg-sunken text-text-secondary font-mono\"\n >\n {scope}\n </span>\n ))}\n </div>\n </ShowMore>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.scopes.empty', 'No scopes granted.')}\n </p>\n )}\n </GlassCard>\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-text-secondary 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 <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary 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-text-secondary\">Vault</span>\n <span className=\"font-medium text-text-primary 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-text-secondary\">Secret</span>\n <span className=\"font-medium text-text-primary 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-text-secondary\">Secret ID</span>\n <span className=\"font-mono text-xs text-text-primary break-all\">\n {connection.credentialSecretId}\n </span>\n </div>\n )}\n </div>\n </GlassCard>\n )}\n\n {/* Actions — hidden entirely when user has no action permissions */}\n {(canUpdate || canDelete) && (\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <Key size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.actions', 'Actions')}\n </h2>\n <CTAOverflowMenu\n align=\"start\"\n primary={{\n label: tx('integrations.connectionDetail.actions.test', 'Test Connection'),\n onSelect: () => {\n void handleTest();\n },\n disabled: actionLoading,\n icon: testing ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Zap size={14} />\n ),\n }}\n actions={[\n ...(canUpdate && connection.provider.authType === 'oauth2' && canRefreshToken\n ? [\n {\n label: tx(\n 'integrations.connectionDetail.actions.refreshToken',\n 'Refresh Token'\n ),\n onSelect: () => {\n void handleRefresh();\n },\n disabled: actionLoading,\n icon: <RotateCcw size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canDelete\n ? [\n {\n label: tx('integrations.connectionDetail.actions.revoke', 'Revoke'),\n onSelect: () => {\n void handleRevoke();\n },\n disabled: actionLoading,\n icon: <Shield size={14} />,\n } satisfies CTAAction,\n {\n label: tx('integrations.connectionDetail.actions.delete', 'Delete'),\n onSelect: () => {\n void handleDelete();\n },\n intent: 'destructive',\n disabled: actionLoading,\n icon: <Trash2 size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ]}\n />\n </GlassCard>\n )}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyDA,SAAgB,IAAmB;CACjC,IAAM,EAAE,oBAAiB,IAAqC,EACxD,EAAE,cAAW,KAAK,gBAAa,GAAiB,EAChD,EAAE,UAAM,IAAS,EACjB,KAAM,GAAa,GAAkB,MAA6C;EACtF,IAAM,IAAa,GAAE,GAAK,EAAO;AAIjC,SAHI,MAAe,IACd,IAEE,OAAO,QAAQ,EAAO,CAAC,QAC3B,GAAO,CAAC,GAAU,OACjB,EACG,QAAQ,KAAK,EAAS,KAAK,OAAO,EAAW,CAAC,CAC9C,QAAQ,IAAI,EAAS,IAAI,OAAO,EAAW,CAAC,EACjD,EACD,GARmB,IADW;IAY3B,EAAE,eAAY,aAAS,UAAO,eAAY,GAAc,KAAgB,GAAG,EAC3E,EAAE,oBAAgB,SAAS,MAAY,GAAmB,EAC1D,EAAE,kBAAc,SAAS,OAAe,IAAiB,EACzD,EAAE,sBAAkB,SAAS,MAAa,GAAqB,EAC/D,EAAE,sBAAkB,SAAS,MAAa,IAAqB,EAC/D,KAAkB,GAAe,GAA0B,eAAe,GAAK,EAE/E,EAAE,kBAAe,WAAW,OAAuB,IAAgB,EACnE,IAAY,EAAc,EAAwB,kBAAkB,EACpE,IAAY,EAAc,EAAwB,kBAAkB,EAEpE,CAAC,GAAY,MAAiB,EAI1B,KAAK,EACT,CAAC,GAAc,KAAmB,EAG9B,KAAK,EACT,CAAC,IA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B,UAAU;SACV,MAAM,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SAC3B,EACD;SACE,OAAO,EAAG,gDAAgD,SAAS;SACnE,gBAAgB;AACT,cAAc;;SAErB,QAAQ;SACR,UAAU;SACV,MAAM,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SAC3B,CACF,GACD,EAAE,CACP;QACD,CAAA,CACQ;;MAEV;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 {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n Button,\n GlassCard,\n EmphasisPanel,\n ShowMore,\n CTAOverflowMenu,\n PagePurpose,\n NextSteps,\n type NextStep,\n type CTAAction,\n} from '@burdenoff/fe-libs/ui';\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-text-secondary\">\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 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\n 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-subtle 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 const nextSteps: NextStep[] = [\n {\n id: 'test',\n label: tx('integrations.connectionDetail.nextSteps.test.label', 'Test the connection'),\n description: tx(\n 'integrations.connectionDetail.nextSteps.test.description',\n 'Run a live check to confirm credentials still work before relying on it.'\n ),\n icon: <Zap size={16} />,\n onClick: () => {\n void handleTest();\n },\n done: connection.status === 'active' && Boolean(testResult?.success),\n },\n ...(canUpdate && connection.provider.authType === 'oauth2' && canRefreshToken\n ? [\n {\n id: 'refresh',\n label: tx(\n 'integrations.connectionDetail.nextSteps.refresh.label',\n 'Refresh the access token'\n ),\n description: tx(\n 'integrations.connectionDetail.nextSteps.refresh.description',\n 'Renew OAuth credentials if requests start failing with an auth error.'\n ),\n icon: <RotateCcw size={16} />,\n onClick: () => {\n void handleRefresh();\n },\n } satisfies NextStep,\n ]\n : []),\n {\n id: 'logs',\n label: tx('integrations.connectionDetail.nextSteps.logs.label', 'Review activity logs'),\n description: tx(\n 'integrations.connectionDetail.nextSteps.logs.description',\n 'See recent requests and errors for this connection to debug issues.'\n ),\n icon: <Activity size={16} />,\n onClick: () => navigate?.(joinPath(basePath, 'logs')),\n },\n ];\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-200',\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 <AlertDialog\n open={deleteDialogOpen}\n onOpenChange={(next) => {\n if (!next) {\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n }\n }}\n >\n <AlertDialogContent className=\"max-w-md\">\n <AlertDialogHeader>\n <AlertDialogTitle>Delete connection</AlertDialogTitle>\n <AlertDialogDescription>\n This removes the connection record immediately. You can also remove the mapped vault\n secret if you no longer need it.\n </AlertDialogDescription>\n </AlertDialogHeader>\n\n {usesVaultCredentials && (\n <label className=\"flex items-start gap-3 rounded-lg border border-border-subtle/60 bg-bg-surface 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 aria-label=\"Also remove mapped vault secret\"\n />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n Also remove mapped vault secret\n </p>\n <p className=\"text-xs text-text-secondary mt-1\">\n Use this only if no other connections rely on the same secret.\n </p>\n </div>\n </label>\n )}\n\n <AlertDialogFooter>\n <AlertDialogCancel\n onClick={() => {\n setDeleteDialogOpen(false);\n setDeleteVaultSecret(false);\n }}\n >\n Cancel\n </AlertDialogCancel>\n <AlertDialogAction\n disabled={deleting}\n onClick={(event) => {\n event.preventDefault();\n confirmDelete();\n }}\n className=\"inline-flex items-center gap-2 bg-status-error-bg text-action-primary-text disabled:opacity-50\"\n >\n {deleting ? <Loader2 size={14} className=\"animate-spin\" /> : <Trash2 size={14} />}\n Delete connection\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\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=\"rounded-xl border border-border-seam bg-accent-wash p-6\">\n <div className=\"flex items-center gap-4\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\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-text-primary\">\n {connection.name}\n </h1>\n <ConnectionStatusBadge status={connection.status} size=\"md\" />\n </div>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n {connection.provider.name} · {getAuthTypeLabel(connection.provider.authType)}\n </p>\n </div>\n </div>\n </div>\n\n {/* Page purpose */}\n <PagePurpose icon={<Activity size={16} />}>\n {tx(\n 'integrations.connectionDetail.purpose',\n 'This is a single live link to {provider}. From here you can confirm it is healthy, see which account and scopes were granted, test it on demand, refresh or revoke its access, and review where its credentials are stored.',\n { provider: connection.provider.name }\n )}\n </PagePurpose>\n\n {/* Next steps — guidance for managing this connection */}\n {(canUpdate || canDelete) && (\n <NextSteps storageKey=\"integrations-connection-detail\" steps={nextSteps} />\n )}\n\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {/* Connection Info — the page's primary emphasis zone */}\n <EmphasisPanel className=\"p-5 space-y-4\">\n <h2 className=\"font-semibold text-text-primary 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-seam\">\n <span className=\"text-xs text-text-secondary uppercase tracking-wide\">\n {tx('integrations.connectionDetail.fields.description', 'Description')}\n </span>\n <p className=\"text-sm text-text-primary mt-0.5\">{connection.description}</p>\n </div>\n )}\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.fields.provider', 'Provider')}\n </span>\n <span className=\"text-sm font-medium text-text-primary\">\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-seam\">\n <span className=\"text-sm text-text-secondary 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-text-primary\">\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-seam\">\n <span className=\"text-sm text-text-secondary 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-text-primary\">\n {connection.externalAccountName}\n </span>\n </div>\n )}\n {connection.errorMessage && (\n <div className=\"py-2 border-b border-border-seam\">\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-seam\">\n <span className=\"text-sm text-text-secondary 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-text-primary\">\n {formatLastUsed(connection.lastUsedAt)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.fields.healthCheck', 'Health Check')}\n </span>\n <span className=\"text-sm text-text-primary\">\n {formatDate(connection.lastHealthCheck)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2\">\n <span className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.fields.created', 'Created')}\n </span>\n <span className=\"text-sm text-text-primary\">{formatDate(connection.createdAt)}</span>\n </div>\n </div>\n </EmphasisPanel>\n\n {/* Scopes & Actions */}\n <div className=\"space-y-4\">\n {/* Granted Scopes */}\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary 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 <ShowMore collapsedHeight={88} label=\"Show all scopes\">\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-bg-sunken text-text-secondary font-mono\"\n >\n {scope}\n </span>\n ))}\n </div>\n </ShowMore>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tx('integrations.connectionDetail.scopes.empty', 'No scopes granted.')}\n </p>\n )}\n </GlassCard>\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-text-secondary 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 <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary 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-text-secondary\">Vault</span>\n <span className=\"font-medium text-text-primary 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-text-secondary\">Secret</span>\n <span className=\"font-medium text-text-primary 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-text-secondary\">Secret ID</span>\n <span className=\"font-mono text-xs text-text-primary break-all\">\n {connection.credentialSecretId}\n </span>\n </div>\n )}\n </div>\n </GlassCard>\n )}\n\n {/* Actions — hidden entirely when user has no action permissions */}\n {(canUpdate || canDelete) && (\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <Key size={18} className=\"text-primary\" />\n {tx('integrations.connectionDetail.sections.actions', 'Actions')}\n </h2>\n <CTAOverflowMenu\n align=\"start\"\n primary={{\n label: tx('integrations.connectionDetail.actions.test', 'Test Connection'),\n onSelect: () => {\n void handleTest();\n },\n disabled: actionLoading,\n icon: testing ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Zap size={14} />\n ),\n }}\n actions={[\n ...(canUpdate && connection.provider.authType === 'oauth2' && canRefreshToken\n ? [\n {\n label: tx(\n 'integrations.connectionDetail.actions.refreshToken',\n 'Refresh Token'\n ),\n onSelect: () => {\n void handleRefresh();\n },\n disabled: actionLoading,\n icon: <RotateCcw size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canDelete\n ? [\n {\n label: tx('integrations.connectionDetail.actions.revoke', 'Revoke'),\n onSelect: () => {\n void handleRevoke();\n },\n disabled: actionLoading,\n icon: <Shield size={14} />,\n } satisfies CTAAction,\n {\n label: tx('integrations.connectionDetail.actions.delete', 'Delete'),\n onSelect: () => {\n void handleDelete();\n },\n intent: 'destructive',\n disabled: actionLoading,\n icon: <Trash2 size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ]}\n />\n </GlassCard>\n )}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,IAAmB;CACjC,IAAM,EAAE,oBAAiB,IAAqC,EACxD,EAAE,cAAW,KAAK,gBAAa,GAAiB,EAChD,EAAE,UAAM,IAAS,EACjB,KAAM,GAAa,GAAkB,MAA6C;EACtF,IAAM,IAAa,GAAE,GAAK,EAAO;AAIjC,SAHI,MAAe,IACd,IAEE,OAAO,QAAQ,EAAO,CAAC,QAC3B,GAAO,CAAC,GAAU,OACjB,EACG,QAAQ,KAAK,EAAS,KAAK,OAAO,EAAW,CAAC,CAC9C,QAAQ,IAAI,EAAS,IAAI,OAAO,EAAW,CAAC,EACjD,EACD,GARmB,IADW;IAY3B,EAAE,eAAY,aAAS,UAAO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AAgB;AACT,cAAc;;SAErB,UAAU;SACV,MAAM,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SAC3B,EACD;SACE,OAAO,EAAG,gDAAgD,SAAS;SACnE,gBAAgB;AACT,cAAc;;SAErB,QAAQ;SACR,UAAU;SACV,MAAM,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;SAC3B,CACF,GACD,EAAE,CACP;QACD,CAAA,CACQ;;MAEV;OACF;;GACF"}
|
|
@@ -2,17 +2,17 @@ import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
|
|
|
2
2
|
import { cn as t } from "../utils/cn.js";
|
|
3
3
|
import { INTEGRATION_PERMISSIONS as n } from "../constants/permissions.js";
|
|
4
4
|
import { formatDate as r } from "../utils/integrationsHelpers.js";
|
|
5
|
-
import { LOG_ACTION_OPTIONS as i, LOG_LEVEL_OPTIONS as
|
|
6
|
-
import { INTEGRATION_FEATURE_FLAGS as
|
|
7
|
-
import { useIntegrationLogs as
|
|
5
|
+
import { LOG_ACTION_OPTIONS as i, LOG_LEVEL_OPTIONS as a } from "../utils/constants.js";
|
|
6
|
+
import { INTEGRATION_FEATURE_FLAGS as o } from "../constants/featureFlags.js";
|
|
7
|
+
import { useIntegrationLogs as ee } from "../hooks/useLogs.js";
|
|
8
8
|
import { useId as s, useMemo as c, useState as l } from "react";
|
|
9
|
-
import { Activity as u, AlertCircle as d, AlertTriangle as f, ArrowLeft as p, Bug as m, ChevronLeft as te, ChevronRight as ne, Download as
|
|
10
|
-
import { usePermissions as
|
|
9
|
+
import { Activity as u, AlertCircle as d, AlertTriangle as f, ArrowLeft as p, Bug as m, ChevronLeft as te, ChevronRight as ne, Download as h, FileText as g, Filter as _, Info as v, Loader2 as y, RefreshCw as b, Search as x, X as S } from "lucide-react";
|
|
10
|
+
import { usePermissions as re } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
11
|
import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
12
12
|
import { useFeatureFlag as E } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
13
|
-
import { Button as D } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
import { Button as D, IllustratedEmptyState as ie, PagePurpose as ae } from "@burdenoff/fe-libs/ui";
|
|
14
14
|
//#region src/integrations/pages/ConnectionLogs.tsx
|
|
15
|
-
function
|
|
15
|
+
function oe(e) {
|
|
16
16
|
switch (e) {
|
|
17
17
|
case "error": return /* @__PURE__ */ w(d, {
|
|
18
18
|
size: 14,
|
|
@@ -22,7 +22,7 @@ function O(e) {
|
|
|
22
22
|
size: 14,
|
|
23
23
|
className: "text-status-warning-text"
|
|
24
24
|
});
|
|
25
|
-
case "info": return /* @__PURE__ */ w(
|
|
25
|
+
case "info": return /* @__PURE__ */ w(v, {
|
|
26
26
|
size: 14,
|
|
27
27
|
className: "text-status-info-text"
|
|
28
28
|
});
|
|
@@ -36,7 +36,7 @@ function O(e) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function O(e) {
|
|
40
40
|
switch (e) {
|
|
41
41
|
case "error": return "text-status-error-text bg-status-error-bg-subtle border-border-default";
|
|
42
42
|
case "warn": return "text-status-warning-text bg-status-warning-bg-subtle border-border-default";
|
|
@@ -45,10 +45,10 @@ function k(e) {
|
|
|
45
45
|
default: return "text-text-secondary bg-bg-sunken border-border-subtle";
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function k(e) {
|
|
49
49
|
return `"${String(e ?? "").replaceAll("\"", "\"\"")}"`;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function A(e) {
|
|
52
52
|
let t = [[
|
|
53
53
|
"Created At",
|
|
54
54
|
"Level",
|
|
@@ -65,16 +65,16 @@ function ie(e) {
|
|
|
65
65
|
e.requestMethod,
|
|
66
66
|
e.requestUrl,
|
|
67
67
|
e.responseStatus
|
|
68
|
-
])].map((e) => e.map(
|
|
68
|
+
])].map((e) => e.map(k).join(",")).join("\n"), n = new Blob([t], { type: "text/csv;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
69
69
|
i.href = r, i.download = `integration-logs-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, i.click(), URL.revokeObjectURL(r);
|
|
70
70
|
}
|
|
71
71
|
function j() {
|
|
72
|
-
let { basePath: u = "/", navigate: f } = e(), { hasPermission: m, isLoading:
|
|
72
|
+
let { basePath: u = "/", navigate: f } = e(), { hasPermission: m, isLoading: v } = re(), k = m(n.LOG_READ), j = E(o.CSV_EXPORT, !0), M = s(), N = `${M}-level`, P = `${M}-action`, [F, I] = l(""), [L, R] = l("all"), [z, B] = l("all"), [V, H] = l(!1), [U, W] = l(1), { logs: G, total: K, loading: q, error: J, refetch: Y } = ee({
|
|
73
73
|
level: L === "all" ? void 0 : L,
|
|
74
74
|
action: z === "all" ? void 0 : z,
|
|
75
75
|
page: U,
|
|
76
76
|
pageSize: 20,
|
|
77
|
-
skip:
|
|
77
|
+
skip: v || !k
|
|
78
78
|
}), X = c(() => {
|
|
79
79
|
if (!F) return G ?? [];
|
|
80
80
|
let e = F.toLowerCase();
|
|
@@ -82,13 +82,13 @@ function j() {
|
|
|
82
82
|
}, [G, F]), Z = Math.ceil((K ?? 0) / 20), Q = F || L !== "all" || z !== "all", $ = () => {
|
|
83
83
|
I(""), R("all"), B("all"), W(1);
|
|
84
84
|
};
|
|
85
|
-
return
|
|
85
|
+
return v ? /* @__PURE__ */ w("div", {
|
|
86
86
|
className: "flex items-center justify-center py-20",
|
|
87
|
-
children: /* @__PURE__ */ w(
|
|
87
|
+
children: /* @__PURE__ */ w(y, {
|
|
88
88
|
size: 48,
|
|
89
89
|
className: "animate-spin text-primary"
|
|
90
90
|
})
|
|
91
|
-
}) :
|
|
91
|
+
}) : k ? /* @__PURE__ */ T("div", {
|
|
92
92
|
className: "space-y-6 p-6 max-w-7xl mx-auto",
|
|
93
93
|
children: [
|
|
94
94
|
/* @__PURE__ */ w("div", {
|
|
@@ -105,7 +105,7 @@ function j() {
|
|
|
105
105
|
}),
|
|
106
106
|
/* @__PURE__ */ w("div", {
|
|
107
107
|
className: "p-2.5 rounded-lg bg-action-primary-bg/10",
|
|
108
|
-
children: /* @__PURE__ */ w(
|
|
108
|
+
children: /* @__PURE__ */ w(g, {
|
|
109
109
|
size: 24,
|
|
110
110
|
className: "text-primary"
|
|
111
111
|
})
|
|
@@ -120,6 +120,10 @@ function j() {
|
|
|
120
120
|
]
|
|
121
121
|
})
|
|
122
122
|
}),
|
|
123
|
+
/* @__PURE__ */ w(ae, {
|
|
124
|
+
icon: /* @__PURE__ */ w(g, { size: 16 }),
|
|
125
|
+
children: "Every request an integration makes — token refreshes, API calls, errors — is recorded here. Use this timeline to confirm a connection is working, see exactly what a provider returned, and debug failures (filter by level or action, then export to CSV to share with support)."
|
|
126
|
+
}),
|
|
123
127
|
/* @__PURE__ */ T("div", {
|
|
124
128
|
className: "space-y-4",
|
|
125
129
|
children: [/* @__PURE__ */ T("div", {
|
|
@@ -127,7 +131,7 @@ function j() {
|
|
|
127
131
|
children: [
|
|
128
132
|
/* @__PURE__ */ T("div", {
|
|
129
133
|
className: "flex-1 relative group",
|
|
130
|
-
children: [/* @__PURE__ */ w(
|
|
134
|
+
children: [/* @__PURE__ */ w(x, {
|
|
131
135
|
size: 18,
|
|
132
136
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
|
|
133
137
|
}), /* @__PURE__ */ w("input", {
|
|
@@ -144,20 +148,20 @@ function j() {
|
|
|
144
148
|
onClick: () => H(!V),
|
|
145
149
|
"aria-expanded": V,
|
|
146
150
|
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-action-primary-bg text-action-primary-text border-primary" : "bg-bg-surface text-text-primary border-border-subtle hover:bg-accent"),
|
|
147
|
-
children: [/* @__PURE__ */ w(
|
|
151
|
+
children: [/* @__PURE__ */ w(_, { size: 16 }), " Filter"]
|
|
148
152
|
}),
|
|
149
153
|
j && /* @__PURE__ */ T(D, {
|
|
150
154
|
variant: "outline",
|
|
151
155
|
onClick: () => {
|
|
152
|
-
|
|
156
|
+
A(X);
|
|
153
157
|
},
|
|
154
158
|
disabled: X.length === 0,
|
|
155
|
-
children: [/* @__PURE__ */ w(
|
|
159
|
+
children: [/* @__PURE__ */ w(h, { size: 16 }), " Export CSV"]
|
|
156
160
|
}),
|
|
157
161
|
/* @__PURE__ */ T(D, {
|
|
158
162
|
variant: "outline",
|
|
159
163
|
onClick: () => Y(),
|
|
160
|
-
children: [/* @__PURE__ */ w(
|
|
164
|
+
children: [/* @__PURE__ */ w(b, { size: 16 }), " Refresh"]
|
|
161
165
|
})
|
|
162
166
|
]
|
|
163
167
|
}), V && /* @__PURE__ */ T("div", {
|
|
@@ -166,7 +170,7 @@ function j() {
|
|
|
166
170
|
className: "flex items-center justify-between mb-4",
|
|
167
171
|
children: [/* @__PURE__ */ T("h3", {
|
|
168
172
|
className: "font-semibold text-text-primary flex items-center gap-2",
|
|
169
|
-
children: [/* @__PURE__ */ w(
|
|
173
|
+
children: [/* @__PURE__ */ w(_, {
|
|
170
174
|
size: 16,
|
|
171
175
|
className: "text-primary"
|
|
172
176
|
}), " Filters"]
|
|
@@ -174,7 +178,7 @@ function j() {
|
|
|
174
178
|
type: "button",
|
|
175
179
|
onClick: $,
|
|
176
180
|
className: "text-sm text-text-secondary hover:text-status-error-text flex items-center gap-1",
|
|
177
|
-
children: [/* @__PURE__ */ w(
|
|
181
|
+
children: [/* @__PURE__ */ w(S, { size: 14 }), " Clear All"]
|
|
178
182
|
})]
|
|
179
183
|
}), /* @__PURE__ */ T("div", {
|
|
180
184
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
|
|
@@ -194,7 +198,7 @@ function j() {
|
|
|
194
198
|
children: [/* @__PURE__ */ w("option", {
|
|
195
199
|
value: "all",
|
|
196
200
|
children: "All Levels"
|
|
197
|
-
}),
|
|
201
|
+
}), a.map((e) => /* @__PURE__ */ w("option", {
|
|
198
202
|
value: e.value,
|
|
199
203
|
children: e.label
|
|
200
204
|
}, e.value))]
|
|
@@ -244,14 +248,14 @@ function j() {
|
|
|
244
248
|
type: "button",
|
|
245
249
|
onClick: () => Y(),
|
|
246
250
|
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",
|
|
247
|
-
children: [/* @__PURE__ */ w(
|
|
251
|
+
children: [/* @__PURE__ */ w(b, { size: 14 }), " Try Again"]
|
|
248
252
|
})
|
|
249
253
|
]
|
|
250
254
|
})]
|
|
251
255
|
}),
|
|
252
256
|
q && /* @__PURE__ */ w("div", {
|
|
253
257
|
className: "flex items-center justify-center py-12",
|
|
254
|
-
children: /* @__PURE__ */ w(
|
|
258
|
+
children: /* @__PURE__ */ w(y, {
|
|
255
259
|
size: 24,
|
|
256
260
|
className: "animate-spin text-text-secondary"
|
|
257
261
|
})
|
|
@@ -265,7 +269,7 @@ function j() {
|
|
|
265
269
|
children: [
|
|
266
270
|
/* @__PURE__ */ w("div", {
|
|
267
271
|
className: "mt-0.5",
|
|
268
|
-
children:
|
|
272
|
+
children: oe(e.level)
|
|
269
273
|
}),
|
|
270
274
|
/* @__PURE__ */ T("div", {
|
|
271
275
|
className: "flex-1 min-w-0",
|
|
@@ -274,7 +278,7 @@ function j() {
|
|
|
274
278
|
className: "flex items-center gap-2 flex-wrap",
|
|
275
279
|
children: [
|
|
276
280
|
/* @__PURE__ */ w("span", {
|
|
277
|
-
className: t("text-xs px-2 py-0.5 rounded-full border font-medium",
|
|
281
|
+
className: t("text-xs px-2 py-0.5 rounded-full border font-medium", O(e.level)),
|
|
278
282
|
children: e.level.toUpperCase()
|
|
279
283
|
}),
|
|
280
284
|
/* @__PURE__ */ w("span", {
|
|
@@ -307,31 +311,15 @@ function j() {
|
|
|
307
311
|
]
|
|
308
312
|
}, e.id))
|
|
309
313
|
})
|
|
310
|
-
}) : /* @__PURE__ */
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}),
|
|
320
|
-
/* @__PURE__ */ w("h3", {
|
|
321
|
-
className: "font-semibold text-text-primary mb-1",
|
|
322
|
-
children: Q ? "No matching logs" : "No activity logs yet"
|
|
323
|
-
}),
|
|
324
|
-
/* @__PURE__ */ w("p", {
|
|
325
|
-
className: "text-sm text-text-secondary max-w-sm",
|
|
326
|
-
children: Q ? "Try adjusting your filters." : "Activity logs will appear here once you start using integrations."
|
|
327
|
-
}),
|
|
328
|
-
Q && /* @__PURE__ */ T(D, {
|
|
329
|
-
variant: "outline",
|
|
330
|
-
className: "mt-4",
|
|
331
|
-
onClick: $,
|
|
332
|
-
children: [/* @__PURE__ */ w(x, { size: 14 }), " Clear Filters"]
|
|
333
|
-
})
|
|
334
|
-
]
|
|
314
|
+
}) : /* @__PURE__ */ w(ie, {
|
|
315
|
+
illustration: Q ? "empty-search" : "empty-data",
|
|
316
|
+
title: Q ? "No matching logs" : "No activity logs yet",
|
|
317
|
+
description: Q ? "Try adjusting your filters." : "Activity logs will appear here once you start using integrations.",
|
|
318
|
+
action: Q ? /* @__PURE__ */ T(D, {
|
|
319
|
+
variant: "outline",
|
|
320
|
+
onClick: $,
|
|
321
|
+
children: [/* @__PURE__ */ w(S, { size: 14 }), " Clear Filters"]
|
|
322
|
+
}) : void 0
|
|
335
323
|
}), Z > 1 && /* @__PURE__ */ T("div", {
|
|
336
324
|
className: "flex items-center justify-between px-2",
|
|
337
325
|
children: [/* @__PURE__ */ T("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionLogs.js","names":[],"sources":["../../../src/integrations/pages/ConnectionLogs.tsx"],"sourcesContent":["import { useState, useMemo, useId } 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';\nimport { Button } from '@burdenoff/fe-libs/ui';\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 idPrefix = useId();\n const levelFilterId = `${idPrefix}-level`;\n const actionFilterId = `${idPrefix}-action`;\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-text-secondary mb-4\" />\n <h2 className=\"text-xl font-bold text-text-primary mb-2\">Access Denied</h2>\n <p className=\"text-sm text-text-secondary mb-6 max-w-sm\">\n You don'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-subtle 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=\"rounded-xl border border-border-seam bg-accent-wash p-6\">\n <div className=\"flex items-center gap-4\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate?.(basePath)}\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </Button>\n <div className=\"p-2.5 rounded-lg bg-action-primary-bg/10\">\n <FileText size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl sm:text-3xl font-bold text-text-primary\">Activity Logs</h1>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n Track integration activity and debug issues\n </p>\n </div>\n </div>\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-text-secondary\"\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-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <button\n 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-action-primary-bg text-action-primary-text border-primary'\n : 'bg-bg-surface text-text-primary border-border-subtle hover:bg-accent'\n )}\n >\n <Filter size={16} /> Filter\n </button>\n {canExportCsv && (\n <Button variant=\"outline\" onClick={handleExport} disabled={filteredLogs.length === 0}>\n <Download size={16} /> Export CSV\n </Button>\n )}\n <Button variant=\"outline\" onClick={() => refetch()}>\n <RefreshCw size={16} /> Refresh\n </Button>\n </div>\n\n {showFilters && (\n <div className=\"rounded-xl border border-border-seam bg-bg-surface 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-text-primary flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" /> Filters\n </h3>\n {hasActiveFilters && (\n <button\n type=\"button\"\n onClick={handleClearFilters}\n className=\"text-sm text-text-secondary hover:text-status-error-text 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\n htmlFor={levelFilterId}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Log Level\n </label>\n <select\n id={levelFilterId}\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-subtle rounded-lg bg-bg-surface 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\n htmlFor={actionFilterId}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Action\n </label>\n <select\n id={actionFilterId}\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-subtle rounded-lg bg-bg-surface 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 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-text-secondary\" />\n </div>\n )}\n\n {/* Logs List */}\n {!loading && !error && (\n <>\n {filteredLogs.length > 0 ? (\n <div className=\"rounded-xl border border-border-seam bg-bg-surface overflow-hidden\">\n <div className=\"divide-y divide-border-seam\">\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-bg-sunken text-text-secondary\">\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-text-primary mt-1\">{log.message}</p>\n {log.requestUrl && (\n <p className=\"text-xs text-text-secondary 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-text-secondary 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-bg-sunken/50 mb-4\">\n <FileText size={32} className=\"text-text-secondary\" />\n </div>\n <h3 className=\"font-semibold text-text-primary mb-1\">\n {hasActiveFilters ? 'No matching logs' : 'No activity logs yet'}\n </h3>\n <p className=\"text-sm text-text-secondary 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 variant=\"outline\" className=\"mt-4\" onClick={handleClearFilters}>\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-text-secondary\">\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 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-subtle hover:bg-accent disabled:opacity-50 transition-colors\"\n >\n <ChevronLeft size={16} />\n </button>\n <span className=\"text-sm text-text-primary px-3 py-1.5 rounded-lg bg-bg-sunken\">\n {currentPage} / {totalPages}\n </span>\n <button\n 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-subtle 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":";;;;;;;;;;;;;;AA8BA,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,W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A,KAAyB;MAAE;MAClD,KAAK,IAAI,IAAA,IAAiC,KAAS,EAAE;MAAC;MAAK;MAC1D;QACJ,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,GAAgB,MAAM,KAAK,IAAI,GAAG,IAAI,EAAE,CAAC;OACxD,UAAU,MAAgB;OAC1B,cAAW;OACX,WAAU;iBAEV,kBAAC,IAAD,EAAa,MAAM,IAAM,CAAA;OAClB,CAAA;MACT,kBAAC,QAAD;OAAM,WAAU;iBAAhB;QACG;QAAY;QAAI;QACZ;;MACP,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,GAAgB,MAAM,KAAK,IAAI,GAAY,IAAI,EAAE,CAAC;OACjE,UAAU,MAAgB;OAC1B,cAAW;OACX,WAAU;iBAEV,kBAAC,IAAD,EAAc,MAAM,IAAM,CAAA;OACnB,CAAA;MACL;OACF;MAEP,EAAA,CAAA;GAED;MA/RJ,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAa,MAAM;IAAI,WAAU;IAA6B,CAAA;GAC9D,kBAAC,MAAD;IAAI,WAAU;cAA2C;IAAkB,CAAA;GAC3E,kBAAC,KAAD;IAAG,WAAU;cAA4C;IAErD,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, useId } 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';\nimport { Button, IllustratedEmptyState, PagePurpose } from '@burdenoff/fe-libs/ui';\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 idPrefix = useId();\n const levelFilterId = `${idPrefix}-level`;\n const actionFilterId = `${idPrefix}-action`;\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-text-secondary mb-4\" />\n <h2 className=\"text-xl font-bold text-text-primary mb-2\">Access Denied</h2>\n <p className=\"text-sm text-text-secondary mb-6 max-w-sm\">\n You don'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-subtle 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=\"rounded-xl border border-border-seam bg-accent-wash p-6\">\n <div className=\"flex items-center gap-4\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate?.(basePath)}\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </Button>\n <div className=\"p-2.5 rounded-lg bg-action-primary-bg/10\">\n <FileText size={24} className=\"text-primary\" />\n </div>\n <div>\n <h1 className=\"text-2xl sm:text-3xl font-bold text-text-primary\">Activity Logs</h1>\n <p className=\"text-sm text-text-secondary mt-0.5\">\n Track integration activity and debug issues\n </p>\n </div>\n </div>\n </div>\n\n {/* Page purpose */}\n <PagePurpose icon={<FileText size={16} />}>\n Every request an integration makes — token refreshes, API calls, errors — is recorded here.\n Use this timeline to confirm a connection is working, see exactly what a provider returned,\n and debug failures (filter by level or action, then export to CSV to share with support).\n </PagePurpose>\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-text-secondary\"\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-subtle rounded-lg bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <button\n 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-action-primary-bg text-action-primary-text border-primary'\n : 'bg-bg-surface text-text-primary border-border-subtle hover:bg-accent'\n )}\n >\n <Filter size={16} /> Filter\n </button>\n {canExportCsv && (\n <Button variant=\"outline\" onClick={handleExport} disabled={filteredLogs.length === 0}>\n <Download size={16} /> Export CSV\n </Button>\n )}\n <Button variant=\"outline\" onClick={() => refetch()}>\n <RefreshCw size={16} /> Refresh\n </Button>\n </div>\n\n {showFilters && (\n <div className=\"rounded-xl border border-border-seam bg-bg-surface 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-text-primary flex items-center gap-2\">\n <Filter size={16} className=\"text-primary\" /> Filters\n </h3>\n {hasActiveFilters && (\n <button\n type=\"button\"\n onClick={handleClearFilters}\n className=\"text-sm text-text-secondary hover:text-status-error-text 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\n htmlFor={levelFilterId}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Log Level\n </label>\n <select\n id={levelFilterId}\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-subtle rounded-lg bg-bg-surface 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\n htmlFor={actionFilterId}\n className=\"block text-sm font-medium text-text-primary\"\n >\n Action\n </label>\n <select\n id={actionFilterId}\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-subtle rounded-lg bg-bg-surface 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 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-text-secondary\" />\n </div>\n )}\n\n {/* Logs List */}\n {!loading && !error && (\n <>\n {filteredLogs.length > 0 ? (\n <div className=\"rounded-xl border border-border-seam bg-bg-surface overflow-hidden\">\n <div className=\"divide-y divide-border-seam\">\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-bg-sunken text-text-secondary\">\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-text-primary mt-1\">{log.message}</p>\n {log.requestUrl && (\n <p className=\"text-xs text-text-secondary 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-text-secondary whitespace-nowrap flex-shrink-0\">\n {formatDate(log.createdAt)}\n </span>\n </div>\n ))}\n </div>\n </div>\n ) : (\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-data'}\n title={hasActiveFilters ? 'No matching logs' : 'No activity logs yet'}\n description={\n hasActiveFilters\n ? 'Try adjusting your filters.'\n : 'Activity logs will appear here once you start using integrations.'\n }\n action={\n hasActiveFilters ? (\n <Button variant=\"outline\" onClick={handleClearFilters}>\n <X size={14} /> Clear Filters\n </Button>\n ) : undefined\n }\n />\n )}\n\n {/* Pagination */}\n {totalPages > 1 && (\n <div className=\"flex items-center justify-between px-2\">\n <p className=\"text-sm text-text-secondary\">\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 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-subtle hover:bg-accent disabled:opacity-50 transition-colors\"\n >\n <ChevronLeft size={16} />\n </button>\n <span className=\"text-sm text-text-primary px-3 py-1.5 rounded-lg bg-bg-sunken\">\n {currentPage} / {totalPages}\n </span>\n <button\n 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-subtle 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":";;;;;;;;;;;;;;AA8BA,SAAS,GAAgB,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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