@burdenoff/microfe-integrations 2026.525.3 → 2026.527.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +281 -258
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/CredentialStorageSelector.js +56 -48
- package/dist/integrations/components/CredentialStorageSelector.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 +21 -2
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +10 -2
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionLogs.js +122 -110
- package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +122 -109
- 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 +9 -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 +76 -25
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderCard.js","names":[],"sources":["../../../src/integrations/components/ProviderCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Plug, Link2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { IntegrationProvider } from '../types';\nimport { ProviderIcon } from './ProviderIcon';\n\ninterface ProviderCardProps {\n provider: IntegrationProvider;\n displayMode?: 'grid' | 'list';\n onConnect?: (provider: IntegrationProvider) => void;\n onClick?: (provider: IntegrationProvider) => void;\n}\n\n/**\n * Card component showing provider info (icon, name, category, auth type, connection count).\n * Has a \"Connect\" button.\n */\nexport const ProviderCard: FC<ProviderCardProps> = ({\n provider,\n displayMode = 'grid',\n onConnect,\n onClick,\n}) => {\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 handleConnect = (e: React.MouseEvent) => {\n e.stopPropagation();\n onConnect?.(provider);\n };\n\n const getPluginStatusLabel = (status: IntegrationProvider['pluginStatus']) => {\n switch (status) {\n case 'available':\n return tx('integrations.providerCard.pluginStatus.available', 'Available');\n case 'installed':\n return tx('integrations.providerCard.pluginStatus.installed', 'Installed');\n case 'update_available':\n return tx('integrations.providerCard.pluginStatus.updateAvailable', 'Update');\n case 'deprecated':\n return tx('integrations.providerCard.pluginStatus.deprecated', 'Deprecated');\n default:\n return status;\n }\n };\n\n const getCategoryLabel = (category: IntegrationProvider['category']) => {\n switch (category) {\n case 'communication':\n return tx('integrations.providerCard.category.communication', 'Communication');\n case 'project_management':\n return tx('integrations.providerCard.category.projectManagement', 'Project Management');\n case 'cloud_storage':\n return tx('integrations.providerCard.category.cloudStorage', 'Cloud Storage');\n case 'productivity':\n return tx('integrations.providerCard.category.productivity', 'Productivity');\n case 'crm':\n return tx('integrations.providerCard.category.crm', 'CRM');\n case 'analytics':\n return tx('integrations.providerCard.category.analytics', 'Analytics');\n case 'developer_tools':\n return tx('integrations.providerCard.category.developerTools', 'Developer Tools');\n case 'marketing':\n return tx('integrations.providerCard.category.marketing', 'Marketing');\n case 'finance':\n return tx('integrations.providerCard.category.finance', 'Finance');\n case 'hr':\n return tx('integrations.providerCard.category.hr', 'Human Resources');\n case 'support':\n return tx('integrations.providerCard.category.support', 'Support');\n case 'social':\n return tx('integrations.providerCard.category.social', 'Social');\n case 'ai':\n return tx('integrations.providerCard.category.ai', 'AI & ML');\n case 'email':\n return tx('integrations.providerCard.category.email', 'Email');\n case 'calendar':\n return tx('integrations.providerCard.category.calendar', 'Calendar');\n case 'other':\n return tx('integrations.providerCard.category.other', 'Other');\n default:\n return category;\n }\n };\n\n const getAuthTypeLabel = (authType: IntegrationProvider['authType']) => {\n switch (authType) {\n case 'oauth2':\n return tx('integrations.providerCard.authType.oauth2', 'OAuth 2.0');\n case 'api_key':\n return tx('integrations.providerCard.authType.apiKey', 'API Key');\n case 'basic_auth':\n return tx('integrations.providerCard.authType.basicAuth', 'Basic Auth');\n case 'bearer_token':\n return tx('integrations.providerCard.authType.bearerToken', 'Bearer Token');\n default:\n return authType;\n }\n };\n\n const pluginBadgeClass =\n provider.pluginStatus === 'installed'\n ? 'text-status-success-text bg-status-success-bg-subtle border-border-default'\n : provider.pluginStatus === 'update_available'\n ? 'text-status-warning-text bg-status-warning-bg-subtle border-border-default'\n : provider.pluginStatus === 'deprecated'\n ? 'text-status-error-text bg-status-error-bg-subtle border-border-default'\n : 'text-text-secondary bg-bg-sunken border-border-subtle';\n\n if (displayMode === 'list') {\n return (\n <div\n className={cn(\n 'group flex items-center gap-4 p-4 rounded-xl border border-border/50',\n 'bg-card hover:bg-accent/30 hover:border-primary/30 hover:shadow-md',\n 'cursor-pointer transition-all duration-200',\n 'animate-in fade-in-0 slide-in-from-bottom-1'\n )}\n onClick={() => onClick?.(provider)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(provider);\n }\n }}\n >\n <ProviderIcon provider={provider} size={40} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-foreground truncate\">{provider.name}</h3>\n <span className={cn('text-xs px-2 py-0.5 rounded-full border', pluginBadgeClass)}>\n {getPluginStatusLabel(provider.pluginStatus)}\n </span>\n </div>\n <p className=\"text-sm text-muted-foreground truncate mt-0.5\">{provider.description}</p>\n </div>\n\n <div className=\"flex items-center gap-3 flex-shrink-0\">\n <span className=\"text-xs text-muted-foreground\">\n {getCategoryLabel(provider.category)}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n <span className=\"inline-flex items-center gap-1 text-xs text-muted-foreground\">\n <Link2 size={12} />\n {provider.connectionCount}\n </span>\n {onConnect && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <button\n onClick={handleConnect}\n className=\"px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n {tx('integrations.providerCard.actions.connect', 'Connect')}\n </button>\n )}\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={cn(\n 'group relative flex flex-col p-5 rounded-xl border border-border/50',\n 'bg-card hover:bg-accent/30 hover:border-primary/30 hover:shadow-lg',\n 'cursor-pointer transition-all duration-200',\n 'animate-in fade-in-0 slide-in-from-bottom-2'\n )}\n onClick={() => onClick?.(provider)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(provider);\n }\n }}\n >\n <div className=\"flex items-start justify-between mb-3\">\n <ProviderIcon provider={provider} size={48} />\n <span className={cn('text-xs px-2 py-0.5 rounded-full border', pluginBadgeClass)}>\n {getPluginStatusLabel(provider.pluginStatus)}\n </span>\n </div>\n\n <h3 className=\"font-semibold text-foreground mb-1 truncate\">{provider.name}</h3>\n <p className=\"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1\">\n {provider.description}\n </p>\n\n <div className=\"flex items-center gap-2 flex-wrap mb-3\">\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground\">\n {getCategoryLabel(provider.category)}\n </span>\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n </div>\n\n <div className=\"flex items-center justify-between mt-auto pt-3 border-t border-border/50\">\n <span className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground\">\n <Plug size={14} />\n {provider.connectionCount}{' '}\n {provider.connectionCount === 1\n ? tx('integrations.providerCard.connectionCount.single', 'connection')\n : tx('integrations.providerCard.connectionCount.multiple', 'connections')}\n </span>\n {onConnect && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <button\n onClick={handleConnect}\n className=\"px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n {tx('integrations.providerCard.actions.connect', 'Connect')}\n </button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;AAkBA,IAAa,KAAuC,EAClD,aACA,iBAAc,QACd,cACA,iBACI;CACJ,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MAA6C;EACtF,IAAM,IAAa,EAAE,GAAK,EAAO;AAIjC,SAHI,MAAe,IACd,IAEE,OAAO,QAAQ,EAAO,CAAC,QAC3B,GAAO,CAAC,GAAU,OAC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ET,EAAG,6CAA6C,UAAU;MACpD,CAAA;KAEP;;GACF;MAKR,kBAAC,OAAD;EACE,WAAW,EACT,uEACA,sEACA,8CACA,8CACD;EACD,eAAe,IAAU,EAAS;EAClC,MAAK;EACL,UAAU;EACV,YAAY,MAAM;AAChB,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,IAAU,EAAS;;YAbzB;GAiBE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAwB;KAAU,MAAM;KAAM,CAAA,EAC9C,kBAAC,QAAD;KAAM,WAAW,EAAG,2CAA2C,EAAiB;eAC7E,EAAqB,EAAS,aAAa;KACvC,CAAA,CACH;;GAEN,kBAAC,MAAD;IAAI,WAAU;cAA+C,EAAS;IAAU,CAAA;GAChF,kBAAC,KAAD;IAAG,WAAU;cACV,EAAS;IACR,CAAA;GAEJ,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eACb,EAAiB,EAAS,SAAS;KAC/B,CAAA,EACP,kBAAC,QAAD;KAAM,WAAU;eACb,EAAiB,EAAS,SAAS;KAC/B,CAAA,CACH;;GAEN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;MACjB,EAAS;MAAiB;MAC1B,EAAS,oBAAoB,IAC1B,EAAG,oDAAoD,aAAa,GACpE,EAAG,sDAAsD,cAAc;MACtE;QACN,KAAa,EAAS,iBAAiB,eAAe,EAAS,aAC9D,kBAAC,UAAD;KACE,SAAS;KACT,WAAU;eAET,EAAG,6CAA6C,UAAU;KACpD,CAAA,CAEP;;GACF"}
|
|
1
|
+
{"version":3,"file":"ProviderCard.js","names":[],"sources":["../../../src/integrations/components/ProviderCard.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Plug, Link2 } from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { IntegrationProvider } from '../types';\nimport { ProviderIcon } from './ProviderIcon';\n\ninterface ProviderCardProps {\n provider: IntegrationProvider;\n displayMode?: 'grid' | 'list';\n onConnect?: (provider: IntegrationProvider) => void;\n onClick?: (provider: IntegrationProvider) => void;\n}\n\n/**\n * Card component showing provider info (icon, name, category, auth type, connection count).\n * Has a \"Connect\" button.\n */\nexport const ProviderCard: FC<ProviderCardProps> = ({\n provider,\n displayMode = 'grid',\n onConnect,\n onClick,\n}) => {\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 handleConnect = (e: React.MouseEvent) => {\n e.stopPropagation();\n onConnect?.(provider);\n };\n\n const getPluginStatusLabel = (status: IntegrationProvider['pluginStatus']) => {\n switch (status) {\n case 'available':\n return tx('integrations.providerCard.pluginStatus.available', 'Available');\n case 'installed':\n return tx('integrations.providerCard.pluginStatus.installed', 'Installed');\n case 'update_available':\n return tx('integrations.providerCard.pluginStatus.updateAvailable', 'Update');\n case 'deprecated':\n return tx('integrations.providerCard.pluginStatus.deprecated', 'Deprecated');\n default:\n return status;\n }\n };\n\n const getCategoryLabel = (category: IntegrationProvider['category']) => {\n switch (category) {\n case 'communication':\n return tx('integrations.providerCard.category.communication', 'Communication');\n case 'project_management':\n return tx('integrations.providerCard.category.projectManagement', 'Project Management');\n case 'cloud_storage':\n return tx('integrations.providerCard.category.cloudStorage', 'Cloud Storage');\n case 'productivity':\n return tx('integrations.providerCard.category.productivity', 'Productivity');\n case 'crm':\n return tx('integrations.providerCard.category.crm', 'CRM');\n case 'analytics':\n return tx('integrations.providerCard.category.analytics', 'Analytics');\n case 'developer_tools':\n return tx('integrations.providerCard.category.developerTools', 'Developer Tools');\n case 'marketing':\n return tx('integrations.providerCard.category.marketing', 'Marketing');\n case 'finance':\n return tx('integrations.providerCard.category.finance', 'Finance');\n case 'hr':\n return tx('integrations.providerCard.category.hr', 'Human Resources');\n case 'support':\n return tx('integrations.providerCard.category.support', 'Support');\n case 'social':\n return tx('integrations.providerCard.category.social', 'Social');\n case 'ai':\n return tx('integrations.providerCard.category.ai', 'AI & ML');\n case 'email':\n return tx('integrations.providerCard.category.email', 'Email');\n case 'calendar':\n return tx('integrations.providerCard.category.calendar', 'Calendar');\n case 'other':\n return tx('integrations.providerCard.category.other', 'Other');\n default:\n return category;\n }\n };\n\n const getAuthTypeLabel = (authType: IntegrationProvider['authType']) => {\n switch (authType) {\n case 'oauth2':\n return tx('integrations.providerCard.authType.oauth2', 'OAuth 2.0');\n case 'api_key':\n return tx('integrations.providerCard.authType.apiKey', 'API Key');\n case 'basic_auth':\n return tx('integrations.providerCard.authType.basicAuth', 'Basic Auth');\n case 'bearer_token':\n return tx('integrations.providerCard.authType.bearerToken', 'Bearer Token');\n default:\n return authType;\n }\n };\n\n const pluginBadgeClass =\n provider.pluginStatus === 'installed'\n ? 'text-status-success-text bg-status-success-bg-subtle border-border-default'\n : provider.pluginStatus === 'update_available'\n ? 'text-status-warning-text bg-status-warning-bg-subtle border-border-default'\n : provider.pluginStatus === 'deprecated'\n ? 'text-status-error-text bg-status-error-bg-subtle border-border-default'\n : 'text-text-secondary bg-bg-sunken border-border-subtle';\n\n if (displayMode === 'list') {\n return (\n <div\n className={cn(\n 'group flex items-center gap-4 p-4 rounded-xl border border-border/50',\n 'bg-card hover:bg-accent/30 hover:border-primary/30 hover:shadow-md',\n 'cursor-pointer transition-all duration-200',\n 'animate-in fade-in-0 slide-in-from-bottom-1'\n )}\n onClick={() => onClick?.(provider)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(provider);\n }\n }}\n >\n <ProviderIcon provider={provider} size={40} />\n\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold text-foreground truncate\">{provider.name}</h3>\n <span className={cn('text-xs px-2 py-0.5 rounded-full border', pluginBadgeClass)}>\n {getPluginStatusLabel(provider.pluginStatus)}\n </span>\n </div>\n <p className=\"text-sm text-muted-foreground truncate mt-0.5\">{provider.description}</p>\n </div>\n\n <div className=\"flex items-center gap-3 flex-shrink-0\">\n <span className=\"text-xs text-muted-foreground\">\n {getCategoryLabel(provider.category)}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n <span className=\"inline-flex items-center gap-1 text-xs text-muted-foreground\">\n <Link2 size={12} />\n {provider.connectionCount}\n </span>\n {onConnect && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <button\n type=\"button\"\n onClick={handleConnect}\n className=\"px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n {tx('integrations.providerCard.actions.connect', 'Connect')}\n </button>\n )}\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={cn(\n 'group relative flex flex-col p-5 rounded-xl border border-border/50',\n 'bg-card hover:bg-accent/30 hover:border-primary/30 hover:shadow-lg',\n 'cursor-pointer transition-all duration-200',\n 'animate-in fade-in-0 slide-in-from-bottom-2'\n )}\n onClick={() => onClick?.(provider)}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onClick?.(provider);\n }\n }}\n >\n <div className=\"flex items-start justify-between mb-3\">\n <ProviderIcon provider={provider} size={48} />\n <span className={cn('text-xs px-2 py-0.5 rounded-full border', pluginBadgeClass)}>\n {getPluginStatusLabel(provider.pluginStatus)}\n </span>\n </div>\n\n <h3 className=\"font-semibold text-foreground mb-1 truncate\">{provider.name}</h3>\n <p className=\"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1\">\n {provider.description}\n </p>\n\n <div className=\"flex items-center gap-2 flex-wrap mb-3\">\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground\">\n {getCategoryLabel(provider.category)}\n </span>\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n </div>\n\n <div className=\"flex items-center justify-between mt-auto pt-3 border-t border-border/50\">\n <span className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground\">\n <Plug size={14} />\n {provider.connectionCount}{' '}\n {provider.connectionCount === 1\n ? tx('integrations.providerCard.connectionCount.single', 'connection')\n : tx('integrations.providerCard.connectionCount.multiple', 'connections')}\n </span>\n {onConnect && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <button\n type=\"button\"\n onClick={handleConnect}\n className=\"px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n {tx('integrations.providerCard.actions.connect', 'Connect')}\n </button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;AAkBA,IAAa,KAAuC,EAClD,aACA,iBAAc,QACd,cACA,iBACI;CACJ,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,GAAkB,MAA6C;EACtF,IAAM,IAAa,EAAE,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,KAAiB,MAAwB;AAE7C,EADA,EAAE,iBAAiB,EACnB,IAAY,EAAS;IAGjB,KAAwB,MAAgD;AAC5E,UAAQ,GAAR;GACE,KAAK,YACH,QAAO,EAAG,oDAAoD,YAAY;GAC5E,KAAK,YACH,QAAO,EAAG,oDAA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CACE,kBAAC,GAAD;KAAwB;KAAU,MAAM;KAAM,CAAA,EAC9C,kBAAC,QAAD;KAAM,WAAW,EAAG,2CAA2C,EAAiB;eAC7E,EAAqB,EAAS,aAAa;KACvC,CAAA,CACH;;GAEN,kBAAC,MAAD;IAAI,WAAU;cAA+C,EAAS;IAAU,CAAA;GAChF,kBAAC,KAAD;IAAG,WAAU;cACV,EAAS;IACR,CAAA;GAEJ,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eACb,EAAiB,EAAS,SAAS;KAC/B,CAAA,EACP,kBAAC,QAAD;KAAM,WAAU;eACb,EAAiB,EAAS,SAAS;KAC/B,CAAA,CACH;;GAEN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;MACjB,EAAS;MAAiB;MAC1B,EAAS,oBAAoB,IAC1B,EAAG,oDAAoD,aAAa,GACpE,EAAG,sDAAsD,cAAc;MACtE;QACN,KAAa,EAAS,iBAAiB,eAAe,EAAS,aAC9D,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;eAET,EAAG,6CAA6C,UAAU;KACpD,CAAA,CAEP;;GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnections.js","names":[],"sources":["../../../src/integrations/hooks/useConnections.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for connections.\n */\n\nimport { useCallback } from 'react';\nimport {\n useGetConnectionsQuery,\n useGetConnectionQuery,\n useGetConnectionsByProviderQuery,\n useCreateConnectionMutation,\n useUpdateConnectionMutation,\n useInitiateOAuthMutation,\n useCompleteOAuthMutation,\n useAuthenticateWithApiKeyMutation,\n useAuthenticateWithBasicAuthMutation,\n useAuthenticateWithBearerTokenMutation,\n useRefreshConnectionTokenMutation,\n useRevokeConnectionMutation,\n useTestConnectionMutation,\n useDeleteConnectionMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { mapConnection } from '../utils/mappers';\nimport type {\n IntegrationConnection,\n ConnectionStatus,\n OAuthInitiationResult,\n ConnectionTestResult,\n} from '../types';\n\n// ─── Query Hooks ────────────────────────────────────────────────────────────\n\ninterface ConnectionFilterOptions {\n status?: ConnectionStatus;\n providerId?: string;\n search?: string;\n}\n\nexport function useConnections(filter?: ConnectionFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnections?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return { connections, total: data?.getConnections?.total ?? 0, loading, error, refetch };\n}\n\nexport function useConnection(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const connection: IntegrationConnection | null = data?.getConnection\n ? mapConnection(data.getConnection as Record<string, unknown>)\n : null;\n\n return { connection, loading, error, refetch };\n}\n\nexport function useConnectionsByProvider(providerId: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsByProviderQuery({\n variables: { providerId, pagination: { limit: 100 } },\n skip: !workspaceId || !providerId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnectionsByProvider?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnectionsByProvider?.total ?? 0,\n loading,\n error,\n refetch,\n };\n}\n\n// ─── Mutation Hooks ─────────────────────────────────────────────────────────\n\nexport function useCreateConnection() {\n const [mutate, { loading }] = useCreateConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const createConnection = useCallback(\n async (input: {\n name: string;\n description?: string;\n providerId: string;\n vaultId?: string;\n credentialSecretId?: string;\n managedSecretName?: string;\n config?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n const id = result.data?.createConnection?.id as string | undefined;\n if (id) {\n eventBus.emit('integrations:connection-created', {\n connectionId: id,\n providerKey: input.providerId,\n });\n }\n return id;\n },\n [mutate, eventBus]\n );\n\n return { createConnection, loading };\n}\n\nexport function useUpdateConnection() {\n const [mutate, { loading }] = useUpdateConnectionMutation({\n refetchQueries: ['GetConnections', 'GetConnection'],\n });\n\n const updateConnection = useCallback(\n async (id: string, input: { name?: string; description?: string }) => {\n const result = await mutate({ variables: { id, input } });\n return result.data?.updateConnection;\n },\n [mutate]\n );\n\n return { updateConnection, loading };\n}\n\nexport function useDeleteConnection() {\n const [mutate, { loading }] = useDeleteConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const deleteConnection = useCallback(\n async (id: string, deleteVaultSecret = false) => {\n await mutate({ variables: { id, deleteVaultSecret } });\n eventBus.emit('integrations:connection-deleted', { connectionId: id });\n },\n [mutate, eventBus]\n );\n\n return { deleteConnection, loading };\n}\n\nexport function useInitiateOAuth() {\n const [mutate, { loading }] = useInitiateOAuthMutation();\n const eventBus = useIntegrationsEventBus();\n\n const initiateOAuth = useCallback(\n async (\n connectionId: string,\n redirectUri: string,\n providerKey: string,\n scopes?: string[]\n ): Promise<OAuthInitiationResult | null> => {\n eventBus.emit('integrations:oauth-started', { connectionId, providerKey });\n const result = await mutate({ variables: { input: { connectionId, redirectUri, scopes } } });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n }\n return result.data?.initiateOAuth ?? null;\n },\n [mutate, eventBus]\n );\n\n return { initiateOAuth, loading };\n}\n\nexport function useCompleteOAuth() {\n const [mutate, { loading }] = useCompleteOAuthMutation({\n refetchQueries: ['GetConnections', 'GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const completeOAuth = useCallback(\n async (\n connectionId: string,\n code: string,\n state: string,\n redirectUri: string,\n providerKey: string\n ) => {\n const result = await mutate({\n variables: { input: { connectionId, code, state, redirectUri } },\n });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n } else {\n eventBus.emit('integrations:oauth-completed', { connectionId, providerKey });\n }\n return result.data?.completeOAuth;\n },\n [mutate, eventBus]\n );\n\n return { completeOAuth, loading };\n}\n\nexport function useAuthenticateWithApiKey() {\n const [mutate, { loading }] = useAuthenticateWithApiKeyMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithApiKey = useCallback(\n async (connectionId: string, apiKey: string) => {\n const result = await mutate({ variables: { input: { connectionId, apiKey } } });\n return result.data?.authenticateWithApiKey;\n },\n [mutate]\n );\n\n return { authenticateWithApiKey, loading };\n}\n\nexport function useAuthenticateWithBasicAuth() {\n const [mutate, { loading }] = useAuthenticateWithBasicAuthMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBasicAuth = useCallback(\n async (connectionId: string, username: string, password: string) => {\n const result = await mutate({ variables: { input: { connectionId, username, password } } });\n return result.data?.authenticateWithBasicAuth;\n },\n [mutate]\n );\n\n return { authenticateWithBasicAuth, loading };\n}\n\nexport function useAuthenticateWithBearerToken() {\n const [mutate, { loading }] = useAuthenticateWithBearerTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBearerToken = useCallback(\n async (connectionId: string, token: string) => {\n const result = await mutate({ variables: { input: { connectionId, token } } });\n return result.data?.authenticateWithBearerToken;\n },\n [mutate]\n );\n\n return { authenticateWithBearerToken, loading };\n}\n\nexport function useRefreshToken() {\n const [mutate, { loading }] = useRefreshConnectionTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const refreshToken = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.refreshConnectionToken) {\n eventBus.emit('integrations:token-refreshed', { connectionId });\n }\n return result.data?.refreshConnectionToken;\n },\n [mutate, eventBus]\n );\n\n return { refreshToken, loading };\n}\n\nexport function useRevokeConnection() {\n const [mutate, { loading }] = useRevokeConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const revokeConnection = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.revokeConnection) {\n eventBus.emit('integrations:token-revoked', { connectionId });\n }\n return result.data?.revokeConnection;\n },\n [mutate, eventBus]\n );\n\n return { revokeConnection, loading };\n}\n\nexport function useTestConnection() {\n const [mutate, { loading }] = useTestConnectionMutation();\n\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n const result = await mutate({ variables: { connectionId } });\n return result.data?.testConnection ?? null;\n },\n [mutate]\n );\n\n return { testConnection, loading };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,EAAe,GAAkC;CAC/D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuB;EAC/D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,cAJqC,GAAM,gBAAgB,SAAS,EAAE,EAAE,KAC9E,MAAkC,EAAc,EAAK,CACvD;EAEqB,OAAO,GAAM,gBAAgB,SAAS;EAAG;EAAS;EAAO;EAAS;;AAG1F,SAAgB,EAAc,GAAY;CACxC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAsB;EAC9D,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,YAJwC,GAAM,gBACnD,EAAc,EAAK,cAAyC,GAC5D;EAEiB;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AAkB;CAChC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAAkC,EAC9D,gBAAgB,CAAC,gBAAgB,EAClC,CAAC,EACI,IAAW,GAAyB;AAa1C,QAAO;EAAE,cAXY,EACnB,OAAO,MAAyB;GAC9B,IAAM,IAAS,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC;AAI5D,UAHI,EAAO,MAAM,0BACf,EAAS,KAAK,gCAAgC,EAAE,iBAAc,CAAC,EAE1D,EAAO,MAAM;KAEtB,CAAC,GAAQ,EAAS,CACnB;EAEsB;EAAS;;AAGlC,SAAgB,IAAsB;CACpC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAA4B,EACxD,gBAAgB,CAAC,gBAAgB,EAClC,CAAC,EACI,IAAW,GAAyB;AAa1C,QAAO;EAAE,kBAXgB,EACvB,OAAO,MAAyB;GAC9B,IAAM,IAAS,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC;AAI5D,UAHI,EAAO,MAAM,oBACf,EAAS,KAAK,8BAA8B,EAAE,iBAAc,CAAC,EAExD,EAAO,MAAM;KAEtB,CAAC,GAAQ,EAAS,CACnB;EAE0B;EAAS;;AAGtC,SAAgB,IAAoB;CAClC,IAAM,CAAC,GAAQ,EAAE,gBAAa,GAA2B;AAUzD,QAAO;EAAE,gBARc,EACrB,OAAO,OACU,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC,EAC9C,MAAM,kBAAkB,MAExC,CAAC,EAAO,CACT;EAEwB;EAAS"}
|
|
1
|
+
{"version":3,"file":"useConnections.js","names":[],"sources":["../../../src/integrations/hooks/useConnections.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for connections.\n */\n\nimport { useCallback } from 'react';\nimport {\n useGetConnectionsQuery,\n useGetConnectionQuery,\n useGetConnectionsByProviderQuery,\n useCreateConnectionMutation,\n useInitiateOAuthMutation,\n useAuthenticateWithApiKeyMutation,\n useAuthenticateWithBasicAuthMutation,\n useAuthenticateWithBearerTokenMutation,\n useRefreshConnectionTokenMutation,\n useRevokeConnectionMutation,\n useTestConnectionMutation,\n useDeleteConnectionMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { useIntegrationsEventBus } from '../events/useIntegrationsEventBus';\nimport { mapConnection } from '../utils/mappers';\nimport type {\n IntegrationConnection,\n ConnectionStatus,\n OAuthInitiationResult,\n ConnectionTestResult,\n} from '../types';\n\n// ─── Query Hooks ────────────────────────────────────────────────────────────\n\ninterface ConnectionFilterOptions {\n status?: ConnectionStatus;\n providerId?: string;\n search?: string;\n}\n\nexport function useConnections(filter?: ConnectionFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnections?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return { connections, total: data?.getConnections?.total ?? 0, loading, error, refetch };\n}\n\nexport function useConnection(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const connection: IntegrationConnection | null = data?.getConnection\n ? mapConnection(data.getConnection as Record<string, unknown>)\n : null;\n\n return { connection, loading, error, refetch };\n}\n\nexport function useConnectionsByProvider(providerId: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetConnectionsByProviderQuery({\n variables: { providerId, pagination: { limit: 100 } },\n skip: !workspaceId || !providerId,\n errorPolicy: 'all',\n });\n\n const connections: IntegrationConnection[] = (data?.getConnectionsByProvider?.items ?? []).map(\n (item: Record<string, unknown>) => mapConnection(item)\n );\n\n return {\n connections,\n total: data?.getConnectionsByProvider?.total ?? 0,\n loading,\n error,\n refetch,\n };\n}\n\n// ─── Mutation Hooks ─────────────────────────────────────────────────────────\n\nexport function useCreateConnection() {\n const [mutate, { loading }] = useCreateConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const createConnection = useCallback(\n async (input: {\n name: string;\n description?: string;\n providerId: string;\n vaultId?: string;\n credentialSecretId?: string;\n managedSecretName?: string;\n config?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n const id = result.data?.createConnection?.id as string | undefined;\n if (id) {\n eventBus.emit('integrations:connection-created', {\n connectionId: id,\n providerKey: input.providerId,\n });\n }\n return id;\n },\n [mutate, eventBus]\n );\n\n return { createConnection, loading };\n}\n\nexport function useDeleteConnection() {\n const [mutate, { loading }] = useDeleteConnectionMutation({\n refetchQueries: ['GetConnections'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const deleteConnection = useCallback(\n async (id: string, deleteVaultSecret = false) => {\n await mutate({ variables: { id, deleteVaultSecret } });\n eventBus.emit('integrations:connection-deleted', { connectionId: id });\n },\n [mutate, eventBus]\n );\n\n return { deleteConnection, loading };\n}\n\nexport function useInitiateOAuth() {\n const [mutate, { loading }] = useInitiateOAuthMutation();\n const eventBus = useIntegrationsEventBus();\n\n const initiateOAuth = useCallback(\n async (\n connectionId: string,\n redirectUri: string,\n providerKey: string,\n scopes?: string[]\n ): Promise<OAuthInitiationResult | null> => {\n eventBus.emit('integrations:oauth-started', { connectionId, providerKey });\n const result = await mutate({ variables: { input: { connectionId, redirectUri, scopes } } });\n if (result.error) {\n eventBus.emit('integrations:oauth-failed', {\n connectionId,\n providerKey,\n error: result.error.message,\n });\n }\n return result.data?.initiateOAuth ?? null;\n },\n [mutate, eventBus]\n );\n\n return { initiateOAuth, loading };\n}\n\nexport function useAuthenticateWithApiKey() {\n const [mutate, { loading }] = useAuthenticateWithApiKeyMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithApiKey = useCallback(\n async (connectionId: string, apiKey: string) => {\n const result = await mutate({ variables: { input: { connectionId, apiKey } } });\n return result.data?.authenticateWithApiKey;\n },\n [mutate]\n );\n\n return { authenticateWithApiKey, loading };\n}\n\nexport function useAuthenticateWithBasicAuth() {\n const [mutate, { loading }] = useAuthenticateWithBasicAuthMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBasicAuth = useCallback(\n async (connectionId: string, username: string, password: string) => {\n const result = await mutate({ variables: { input: { connectionId, username, password } } });\n return result.data?.authenticateWithBasicAuth;\n },\n [mutate]\n );\n\n return { authenticateWithBasicAuth, loading };\n}\n\nexport function useAuthenticateWithBearerToken() {\n const [mutate, { loading }] = useAuthenticateWithBearerTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n\n const authenticateWithBearerToken = useCallback(\n async (connectionId: string, token: string) => {\n const result = await mutate({ variables: { input: { connectionId, token } } });\n return result.data?.authenticateWithBearerToken;\n },\n [mutate]\n );\n\n return { authenticateWithBearerToken, loading };\n}\n\nexport function useRefreshToken() {\n const [mutate, { loading }] = useRefreshConnectionTokenMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const refreshToken = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.refreshConnectionToken) {\n eventBus.emit('integrations:token-refreshed', { connectionId });\n }\n return result.data?.refreshConnectionToken;\n },\n [mutate, eventBus]\n );\n\n return { refreshToken, loading };\n}\n\nexport function useRevokeConnection() {\n const [mutate, { loading }] = useRevokeConnectionMutation({\n refetchQueries: ['GetConnection'],\n });\n const eventBus = useIntegrationsEventBus();\n\n const revokeConnection = useCallback(\n async (connectionId: string) => {\n const result = await mutate({ variables: { connectionId } });\n if (result.data?.revokeConnection) {\n eventBus.emit('integrations:token-revoked', { connectionId });\n }\n return result.data?.revokeConnection;\n },\n [mutate, eventBus]\n );\n\n return { revokeConnection, loading };\n}\n\nexport function useTestConnection() {\n const [mutate, { loading }] = useTestConnectionMutation();\n\n const testConnection = useCallback(\n async (connectionId: string): Promise<ConnectionTestResult | null> => {\n const result = await mutate({ variables: { connectionId } });\n return result.data?.testConnection ?? null;\n },\n [mutate]\n );\n\n return { testConnection, loading };\n}\n"],"mappings":";;;;;;AAqCA,SAAgB,EAAe,GAAkC;CAC/D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuB;EAC/D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,cAJqC,GAAM,gBAAgB,SAAS,EAAE,EAAE,KAC9E,MAAkC,EAAc,EAAK,CACvD;EAEqB,OAAO,GAAM,gBAAgB,SAAS;EAAG;EAAS;EAAO;EAAS;;AAG1F,SAAgB,EAAc,GAAY;CACxC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAsB;EAC9D,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,YAJwC,GAAM,gBACnD,EAAc,EAAK,cAAyC,GAC5D;EAEiB;EAAS;EAAO;EAAS;;AAGhD,SAAgB,EAAyB,GAAoB;CAC3D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAiC;EACzE,WAAW;GAAE;GAAY,YAAY,EAAE,OAAO,KAAK;GAAE;EACrD,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EACL,cAL4C,GAAM,0BAA0B,SAAS,EAAE,EAAE,KACxF,MAAkC,EAAc,EAAK,CACvD;EAIC,OAAO,GAAM,0BAA0B,SAAS;EAChD;EACA;EACA;EACD;;AAKH,SAAgB,IAAsB;CACpC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAA4B,EACxD,gBAAgB,CAAC,iBAAiB,EACnC,CAAC,EACI,IAAW,GAAyB;AAyB1C,QAAO;EAAE,kBAvBg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AyB;GAC9B,IAAM,IAAS,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC;AAI5D,UAHI,EAAO,MAAM,oBACf,EAAS,KAAK,8BAA8B,EAAE,iBAAc,CAAC,EAExD,EAAO,MAAM;KAEtB,CAAC,GAAQ,EAAS,CACnB;EAE0B;EAAS;;AAGtC,SAAgB,IAAoB;CAClC,IAAM,CAAC,GAAQ,EAAE,gBAAa,GAA2B;AAUzD,QAAO;EAAE,gBARc,EACrB,OAAO,OACU,MAAM,EAAO,EAAE,WAAW,EAAE,iBAAc,EAAE,CAAC,EAC9C,MAAM,kBAAkB,MAExC,CAAC,EAAO,CACT;EAEwB;EAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogs.js","names":[],"sources":["../../../src/integrations/hooks/useLogs.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries for integration logs.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"useLogs.js","names":[],"sources":["../../../src/integrations/hooks/useLogs.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries for integration logs.\n */\n\nimport { useGetIntegrationLogsQuery } from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { mapLog } from '../utils/mappers';\nimport type { IntegrationLog, LogLevel, LogAction } from '../types';\nimport { DEFAULT_PAGE_SIZE } from '../utils/constants';\n\n// ─── Hooks ──────────────────────────────────────────────────────────────────\n\ninterface LogFilterOptions {\n level?: LogLevel;\n action?: LogAction;\n page?: number;\n pageSize?: number;\n skip?: boolean;\n}\n\nexport function useIntegrationLogs(filter?: LogFilterOptions) {\n const { workspaceId } = useIntegrations();\n const page = filter?.page ?? 1;\n const pageSize = filter?.pageSize ?? DEFAULT_PAGE_SIZE;\n\n const { data, loading, error, refetch } = useGetIntegrationLogsQuery({\n variables: {\n filter: {\n level: filter?.level,\n action: filter?.action,\n },\n pagination: {\n limit: pageSize,\n offset: (page - 1) * pageSize,\n },\n },\n skip: !workspaceId || filter?.skip,\n errorPolicy: 'all',\n });\n\n const logs: IntegrationLog[] = (data?.getIntegrationLogs?.items ?? []).map(\n (item: Record<string, unknown>) => mapLog(item)\n );\n\n return {\n logs,\n total: data?.getIntegrationLogs?.total ?? 0,\n hasMore: data?.getIntegrationLogs?.hasMore ?? false,\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;AAoBA,SAAgB,EAAmB,GAA2B;CAC5D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,IAAO,GAAQ,QAAQ,GACvB,IAAW,GAAQ,YAAA,IAEnB,EAAE,SAAM,YAAS,UAAO,eAAY,EAA2B;EACnE,WAAW;GACT,QAAQ;IACN,OAAO,GAAQ;IACf,QAAQ,GAAQ;IACjB;GACD,YAAY;IACV,OAAO;IACP,SAAS,IAAO,KAAK;IACtB;GACF;EACD,MAAM,CAAC,KAAe,GAAQ;EAC9B,aAAa;EACd,CAAC;AAMF,QAAO;EACL,OAL8B,GAAM,oBAAoB,SAAS,EAAE,EAAE,KACpE,MAAkC,EAAO,EAAK,CAChD;EAIC,OAAO,GAAM,oBAAoB,SAAS;EAC1C,SAAS,GAAM,oBAAoB,WAAW;EAC9C;EACA;EACA;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProviders.js","names":[],"sources":["../../../src/integrations/hooks/useProviders.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for providers.\n *\n * These hooks provide a stable API surface regardless of whether the\n * generated operations exist yet. Until codegen runs, they return\n * empty/loading state so the UI can render without errors.\n */\n\nimport { useCallback } from 'react';\nimport {\n useGetProvidersQuery,\n useGetProviderQuery,\n useGetProviderByKeyQuery,\n
|
|
1
|
+
{"version":3,"file":"useProviders.js","names":[],"sources":["../../../src/integrations/hooks/useProviders.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries and mutations for providers.\n *\n * These hooks provide a stable API surface regardless of whether the\n * generated operations exist yet. Until codegen runs, they return\n * empty/loading state so the UI can render without errors.\n */\n\nimport { useCallback } from 'react';\nimport {\n useGetProvidersQuery,\n useGetProviderQuery,\n useGetProviderByKeyQuery,\n useInstallProviderPluginMutation,\n useUpdateProviderPluginMutation,\n useUninstallProviderPluginMutation,\n useEnableProviderMutation,\n useDisableProviderMutation,\n} from '../../generated/wspace-operations';\nimport { mapProvider } from '../utils/mappers';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport type { IntegrationProvider, ProviderCategory, PluginStatus } from '../types';\n\n// ─── Hooks ──────────────────────────────────────────────────────────────────\n\ninterface ProviderFilterOptions {\n category?: ProviderCategory;\n pluginStatus?: PluginStatus;\n search?: string;\n}\n\nexport function useProviders(filter?: ProviderFilterOptions) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetProvidersQuery({\n variables: { filter, pagination: { limit: 100 } },\n skip: !workspaceId,\n errorPolicy: 'all',\n });\n\n const providers: IntegrationProvider[] = (data?.getProviders?.items ?? []).map(\n (item: Record<string, unknown>) => mapProvider(item)\n );\n\n return { providers, total: data?.getProviders?.total ?? 0, loading, error, refetch };\n}\n\nexport function useProvider(id: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetProviderQuery({\n variables: { id },\n skip: !workspaceId || !id,\n errorPolicy: 'all',\n });\n\n const provider: IntegrationProvider | null = data?.getProvider\n ? mapProvider(data.getProvider as Record<string, unknown>)\n : null;\n\n return { provider, loading, error, refetch };\n}\n\nexport function useProviderByKey(key: string) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetProviderByKeyQuery({\n variables: { key },\n skip: !workspaceId || !key,\n errorPolicy: 'all',\n });\n\n const provider: IntegrationProvider | null = data?.getProviderByKey\n ? mapProvider(data.getProviderByKey as Record<string, unknown>)\n : null;\n\n return { provider, loading, error, refetch };\n}\n\nexport function useInstallPlugin() {\n const [mutate, { loading }] = useInstallProviderPluginMutation({\n refetchQueries: ['GetProviders', 'GetProvider', 'GetProviderCatalog'],\n });\n\n const installPlugin = useCallback(\n async (input: {\n key: string;\n name: string;\n description?: string;\n category: string;\n authType: string;\n icon?: string;\n color?: string;\n website?: string;\n docsUrl?: string;\n oauthConfig?: Record<string, unknown>;\n defaultScopes?: string[];\n availableScopes?: Record<string, unknown>;\n baseUrl?: string;\n apiVersion?: string;\n rateLimitConfig?: Record<string, unknown>;\n pluginVersion?: string;\n pluginAuthor?: string;\n pluginRepository?: string;\n displayOrder?: number;\n supportedFeatures?: string[];\n configSchema?: Record<string, unknown>;\n }) => {\n const result = await mutate({ variables: { input } });\n return result.data?.installProviderPlugin;\n },\n [mutate]\n );\n\n return { installPlugin, loading };\n}\n\nexport function useUpdatePlugin() {\n const [mutate, { loading }] = useUpdateProviderPluginMutation({\n refetchQueries: ['GetProviders', 'GetProvider', 'GetProviderCatalog'],\n });\n\n const updatePlugin = useCallback(\n async (\n id: string,\n input: {\n name?: string;\n description?: string;\n icon?: string;\n color?: string;\n website?: string;\n docsUrl?: string;\n oauthConfig?: Record<string, unknown>;\n defaultScopes?: string[];\n availableScopes?: Record<string, unknown>;\n baseUrl?: string;\n apiVersion?: string;\n rateLimitConfig?: Record<string, unknown>;\n pluginVersion?: string;\n pluginAuthor?: string;\n pluginRepository?: string;\n displayOrder?: number;\n supportedFeatures?: string[];\n configSchema?: Record<string, unknown>;\n isEnabled?: boolean;\n }\n ) => {\n const result = await mutate({ variables: { id, input } });\n return result.data?.updateProviderPlugin;\n },\n [mutate]\n );\n\n return { updatePlugin, loading };\n}\n\nexport function useUninstallPlugin() {\n const [mutate, { loading }] = useUninstallProviderPluginMutation({\n refetchQueries: ['GetProviders', 'GetProvider', 'GetProviderCatalog'],\n });\n\n const uninstallPlugin = useCallback(\n async (id: string) => {\n const result = await mutate({ variables: { id } });\n return result.data?.uninstallProviderPlugin as boolean;\n },\n [mutate]\n );\n\n return { uninstallPlugin, loading };\n}\n\nexport function useEnableProvider() {\n const [mutate, { loading }] = useEnableProviderMutation({\n refetchQueries: ['GetProviders', 'GetProvider'],\n });\n\n const enableProvider = useCallback(\n async (id: string) => {\n const result = await mutate({ variables: { id } });\n return result.data?.enableProvider;\n },\n [mutate]\n );\n\n return { enableProvider, loading };\n}\n\nexport function useDisableProvider() {\n const [mutate, { loading }] = useDisableProviderMutation({\n refetchQueries: ['GetProviders', 'GetProvider'],\n });\n\n const disableProvider = useCallback(\n async (id: string) => {\n const result = await mutate({ variables: { id } });\n return result.data?.disableProvider;\n },\n [mutate]\n );\n\n return { disableProvider, loading };\n}\n"],"mappings":";;;;;AA+BA,SAAgB,EAAa,GAAgC;CAC3D,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAqB;EAC7D,WAAW;GAAE;GAAQ,YAAY,EAAE,OAAO,KAAK;GAAE;EACjD,MAAM,CAAC;EACP,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,YAJiC,GAAM,cAAc,SAAS,EAAE,EAAE,KACxE,MAAkC,EAAY,EAAK,CACrD;EAEmB,OAAO,GAAM,cAAc,SAAS;EAAG;EAAS;EAAO;EAAS;;AAGtF,SAAgB,EAAY,GAAY;CACtC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAoB;EAC5D,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,UAJoC,GAAM,cAC/C,EAAY,EAAK,YAAuC,GACxD;EAEe;EAAS;EAAO;EAAS;;AAG9C,SAAgB,EAAiB,GAAa;CAC5C,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAyB;EACjE,WAAW,EAAE,QAAK;EAClB,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAMF,QAAO;EAAE,UAJoC,GAAM,mBAC/C,EAAY,EAAK,iBAA4C,GAC7D;EAEe;EAAS;EAAO;EAA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O,EAAE,WAAW,EAAE,OAAI,EAAE,CAAC,EACpC,MAAM,iBAEtB,CAAC,EAAO,CACT;EAEyB;EAAS"}
|
|
@@ -16,7 +16,7 @@ import { usePermissions as Ce } from "@burdenoff/fe-libs/shared/providers/shell"
|
|
|
16
16
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
17
17
|
//#region src/integrations/pages/AddConnectionWizard.tsx
|
|
18
18
|
function h() {
|
|
19
|
-
let { providerId: h } = Se(), { basePath: g = "/", navigate: _, apiGatewayUrl: v } = e(), we = xe(), y = c(() => new URLSearchParams(we
|
|
19
|
+
let { providerId: h } = Se(), { basePath: g = "/", navigate: _, apiGatewayUrl: v } = e(), we = xe().search, y = c(() => new URLSearchParams(we), [we]), b = y.get("providerKey") ?? null, x = y.get("returnTo") ?? null, S = y.get("channelId") ?? null, C = !!(x && S), { provider: w, loading: Te } = ne(b ?? ""), { providers: T, loading: E } = re(), { hasPermission: Ee, isLoading: De } = Ce(), Oe = Ee(n.CONNECTION_CREATE), { createConnection: D, loading: ke } = se(), { initiateOAuth: O, loading: Ae } = ce(), { authenticateWithApiKey: k, loading: je } = ie(), { authenticateWithBasicAuth: A, loading: Me } = ae(), { authenticateWithBearerToken: j, loading: Ne } = oe(), [M] = te({ fetchPolicy: "network-only" }), [N, P] = u(h || b ? "configure" : "select_provider"), [F, Pe] = u(null), [I, Fe] = u(""), [L, R] = u(""), [z, Ie] = u(""), [B, Le] = u(""), [V, Re] = u(""), [H, ze] = u(""), [U, Be] = u(""), [W, Ve] = u({
|
|
20
20
|
mode: "managed",
|
|
21
21
|
vaultId: "",
|
|
22
22
|
secretId: "",
|
|
@@ -190,6 +190,7 @@ function h() {
|
|
|
190
190
|
className: "flex items-center gap-4",
|
|
191
191
|
children: [
|
|
192
192
|
/* @__PURE__ */ p("button", {
|
|
193
|
+
type: "button",
|
|
193
194
|
onClick: () => _?.(r(g, "connections")),
|
|
194
195
|
className: "p-2.5 hover:bg-accent rounded-lg transition-all",
|
|
195
196
|
"aria-label": "Back",
|
|
@@ -250,6 +251,7 @@ function h() {
|
|
|
250
251
|
}), /* @__PURE__ */ p("input", {
|
|
251
252
|
type: "text",
|
|
252
253
|
placeholder: "Search installed providers...",
|
|
254
|
+
"aria-label": "Search installed providers",
|
|
253
255
|
value: I,
|
|
254
256
|
onChange: (e) => Fe(e.target.value),
|
|
255
257
|
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"
|
|
@@ -268,6 +270,7 @@ function h() {
|
|
|
268
270
|
className: "text-muted-foreground",
|
|
269
271
|
children: "No installed providers found. Install a provider from the catalog first."
|
|
270
272
|
}), /* @__PURE__ */ p("button", {
|
|
273
|
+
type: "button",
|
|
271
274
|
onClick: () => _?.(r(g, "providers")),
|
|
272
275
|
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",
|
|
273
276
|
children: "Browse Catalog"
|
|
@@ -276,6 +279,7 @@ function h() {
|
|
|
276
279
|
/* @__PURE__ */ p("div", {
|
|
277
280
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-3",
|
|
278
281
|
children: Ke.map((e) => /* @__PURE__ */ m("button", {
|
|
282
|
+
type: "button",
|
|
279
283
|
onClick: () => qe(e),
|
|
280
284
|
className: t("flex items-start gap-3 p-4 rounded-xl border border-border/50 bg-card text-left", "hover:border-primary/50 hover:bg-accent/30 hover:shadow-md transition-all duration-200"),
|
|
281
285
|
children: [/* @__PURE__ */ p(a, {
|
|
@@ -328,6 +332,7 @@ function h() {
|
|
|
328
332
|
}), /* @__PURE__ */ p("input", {
|
|
329
333
|
type: "text",
|
|
330
334
|
id: "conn-name",
|
|
335
|
+
"aria-label": "Connection Name",
|
|
331
336
|
value: L,
|
|
332
337
|
onChange: (e) => R(e.target.value),
|
|
333
338
|
placeholder: "e.g., My Slack Workspace",
|
|
@@ -339,6 +344,7 @@ function h() {
|
|
|
339
344
|
children: "Description"
|
|
340
345
|
}), /* @__PURE__ */ p("textarea", {
|
|
341
346
|
id: "conn-desc",
|
|
347
|
+
"aria-label": "Description",
|
|
342
348
|
value: z,
|
|
343
349
|
onChange: (e) => Ie(e.target.value),
|
|
344
350
|
rows: 3,
|
|
@@ -355,10 +361,12 @@ function h() {
|
|
|
355
361
|
/* @__PURE__ */ m("div", {
|
|
356
362
|
className: "flex gap-3",
|
|
357
363
|
children: [/* @__PURE__ */ p("button", {
|
|
364
|
+
type: "button",
|
|
358
365
|
onClick: () => h || b ? _?.(r(g, "connections")) : P("select_provider"),
|
|
359
366
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
360
367
|
children: "Back"
|
|
361
368
|
}), /* @__PURE__ */ m("button", {
|
|
369
|
+
type: "button",
|
|
362
370
|
onClick: Je,
|
|
363
371
|
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",
|
|
364
372
|
children: ["Next ", /* @__PURE__ */ p(fe, { size: 16 })]
|
|
@@ -378,7 +386,7 @@ function h() {
|
|
|
378
386
|
size: 18,
|
|
379
387
|
className: "text-primary"
|
|
380
388
|
}),
|
|
381
|
-
"Authentication
|
|
389
|
+
"Authentication: ",
|
|
382
390
|
i(F.authType)
|
|
383
391
|
]
|
|
384
392
|
}),
|
|
@@ -420,6 +428,7 @@ function h() {
|
|
|
420
428
|
}), /* @__PURE__ */ p("input", {
|
|
421
429
|
type: "password",
|
|
422
430
|
id: "api-key",
|
|
431
|
+
"aria-label": "API Key",
|
|
423
432
|
value: B,
|
|
424
433
|
onChange: (e) => Le(e.target.value),
|
|
425
434
|
placeholder: "Enter your API key",
|
|
@@ -448,6 +457,7 @@ function h() {
|
|
|
448
457
|
}), /* @__PURE__ */ p("input", {
|
|
449
458
|
type: "text",
|
|
450
459
|
id: "username",
|
|
460
|
+
"aria-label": "Username",
|
|
451
461
|
value: V,
|
|
452
462
|
onChange: (e) => Re(e.target.value),
|
|
453
463
|
placeholder: "Username or email",
|
|
@@ -468,6 +478,7 @@ function h() {
|
|
|
468
478
|
}), /* @__PURE__ */ p("input", {
|
|
469
479
|
type: "password",
|
|
470
480
|
id: "password",
|
|
481
|
+
"aria-label": "Password",
|
|
471
482
|
value: H,
|
|
472
483
|
onChange: (e) => ze(e.target.value),
|
|
473
484
|
placeholder: "Password",
|
|
@@ -500,6 +511,7 @@ function h() {
|
|
|
500
511
|
}), /* @__PURE__ */ p("input", {
|
|
501
512
|
type: "password",
|
|
502
513
|
id: "bearer-token",
|
|
514
|
+
"aria-label": "Bearer Token",
|
|
503
515
|
value: U,
|
|
504
516
|
onChange: (e) => Be(e.target.value),
|
|
505
517
|
placeholder: "Enter your token",
|
|
@@ -511,11 +523,13 @@ function h() {
|
|
|
511
523
|
}), /* @__PURE__ */ m("div", {
|
|
512
524
|
className: "flex gap-3",
|
|
513
525
|
children: [/* @__PURE__ */ p("button", {
|
|
526
|
+
type: "button",
|
|
514
527
|
onClick: () => P("configure"),
|
|
515
528
|
disabled: Z,
|
|
516
529
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50",
|
|
517
530
|
children: "Back"
|
|
518
531
|
}), /* @__PURE__ */ m("button", {
|
|
532
|
+
type: "button",
|
|
519
533
|
onClick: Ye,
|
|
520
534
|
disabled: Z,
|
|
521
535
|
className: "inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",
|
|
@@ -552,16 +566,19 @@ function h() {
|
|
|
552
566
|
className: "flex gap-3",
|
|
553
567
|
children: [
|
|
554
568
|
C && q && /* @__PURE__ */ m("button", {
|
|
569
|
+
type: "button",
|
|
555
570
|
onClick: Xe,
|
|
556
571
|
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",
|
|
557
572
|
children: [/* @__PURE__ */ p(_e, { size: 16 }), "Link to Bot Channel"]
|
|
558
573
|
}),
|
|
559
574
|
!C && q && /* @__PURE__ */ p("button", {
|
|
575
|
+
type: "button",
|
|
560
576
|
onClick: () => _?.(r(g, `connections/${q}`)),
|
|
561
577
|
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",
|
|
562
578
|
children: "View Connection"
|
|
563
579
|
}),
|
|
564
580
|
/* @__PURE__ */ p("button", {
|
|
581
|
+
type: "button",
|
|
565
582
|
onClick: () => _?.(r(g, "connections")),
|
|
566
583
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
567
584
|
children: "All Connections"
|
|
@@ -591,12 +608,14 @@ function h() {
|
|
|
591
608
|
/* @__PURE__ */ m("div", {
|
|
592
609
|
className: "flex gap-3",
|
|
593
610
|
children: [/* @__PURE__ */ p("button", {
|
|
611
|
+
type: "button",
|
|
594
612
|
onClick: () => {
|
|
595
613
|
K(""), P("authenticate");
|
|
596
614
|
},
|
|
597
615
|
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",
|
|
598
616
|
children: "Try Again"
|
|
599
617
|
}), /* @__PURE__ */ p("button", {
|
|
618
|
+
type: "button",
|
|
600
619
|
onClick: () => _?.(r(g, "connections")),
|
|
601
620
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
602
621
|
children: "Cancel"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectionWizard.js","names":[],"sources":["../../../src/integrations/pages/AddConnectionWizard.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, useEffect, useRef } from 'react';\nimport { useParams, useLocation } from 'react-router-dom';\nimport {\n ArrowLeft,\n ArrowRight,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n Key,\n Lock,\n Shield,\n ExternalLink,\n Link,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { joinPath } from '../utils/navigation';\nimport { getAuthTypeLabel, getCategoryLabel } from '../utils/integrationsHelpers';\nimport { useProviders, useProviderByKey } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateWithApiKey,\n useAuthenticateWithBasicAuth,\n useAuthenticateWithBearerToken,\n} from '../hooks/useConnections';\nimport { useGetConnectionLazyQuery } from '../../generated/wspace-operations';\nimport { waitForOAuthPopupCompletion } from '../utils/oauthPopup';\nimport {\n CredentialStorageSelector,\n type CredentialStorageState,\n} from '../components/CredentialStorageSelector';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport type { IntegrationProvider } from '../types';\n\ntype WizardStep = 'select_provider' | 'configure' | 'authenticate' | 'success' | 'error';\n\n/**\n * Add Connection Wizard — multi-step wizard for creating new connections.\n *\n * Supports an optional \"botlit channel flow\" activated by URL search params:\n * ?providerKey=slack-user&returnTo=<url>&channelId=<id>\n *\n * In this flow:\n * - The provider is pre-selected by key (not UUID) and the wizard skips directly to configure.\n * - OAuth redirectUri is set to the backend callback so the backend can exchange the token\n * and redirect back to `returnTo?integrationConnectionId=<id>`.\n * - On success, a \"Link to bot channel\" button navigates to returnTo with the connectionId.\n */\nexport function AddConnectionWizard() {\n const { providerId: preselectedProviderId } = useParams<{ providerId: string }>();\n const { basePath = '/', navigate, apiGatewayUrl } = useIntegrations();\n const location = useLocation();\n\n // ── Parse botlit flow query params ──────────────────────────────────────────\n const searchParams = useMemo(() => new URLSearchParams(location.search), [location.search]);\n const providerKey = searchParams.get('providerKey') ?? null;\n const returnTo = searchParams.get('returnTo') ?? null;\n const channelId = searchParams.get('channelId') ?? null;\n const isBotlitFlow = Boolean(returnTo && channelId);\n\n // If providerKey is present, look up by key; otherwise fall back to preselectedProviderId (UUID)\n const { provider: providerByKey, loading: providerByKeyLoading } = useProviderByKey(\n providerKey ?? ''\n );\n\n const { providers, loading: providersLoading } = useProviders();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateWithApiKey, loading: apiKeyLoading } = useAuthenticateWithApiKey();\n const { authenticateWithBasicAuth, loading: basicAuthLoading } = useAuthenticateWithBasicAuth();\n const { authenticateWithBearerToken, loading: bearerLoading } = useAuthenticateWithBearerToken();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Wizard state\n const initialStep: WizardStep =\n preselectedProviderId || providerKey ? 'configure' : 'select_provider';\n const [step, setStep] = useState<WizardStep>(initialStep);\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Form state\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n const [apiKey, setApiKey] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [bearerToken, setBearerToken] = useState('');\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n\n const [errorMessage, setErrorMessage] = useState('');\n const [createdConnectionId, setCreatedConnectionId] = useState<string | null>(null);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n\n // Cleanup OAuth listener and popup on unmount.\n useEffect(() => {\n return () => {\n oauthCleanupRef.current?.();\n if (oauthPopupRef.current && !oauthPopupRef.current.closed) {\n oauthPopupRef.current.close();\n }\n };\n }, []);\n\n // Find pre-selected provider by UUID (existing flow)\n const preselectedProvider = useMemo(() => {\n if (!preselectedProviderId || !providers) return null;\n return providers.find((p: IntegrationProvider) => p.id === preselectedProviderId) || null;\n }, [preselectedProviderId, providers]);\n\n // Determine effective preselected provider — by key (botlit flow) or by UUID (existing flow)\n const effectivePreselectedProvider = useMemo(\n () => providerByKey ?? preselectedProvider,\n [providerByKey, preselectedProvider]\n );\n\n // Set provider on first load if preselected (both flows)\n useEffect(() => {\n if (effectivePreselectedProvider && !selectedProvider && step === 'configure') {\n setSelectedProvider(effectivePreselectedProvider);\n if (!connectionName) {\n setConnectionName(`${effectivePreselectedProvider.name} Connection`);\n }\n }\n }, [effectivePreselectedProvider, selectedProvider, step, connectionName]);\n\n // Filter providers for selection step\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) || (p.description ?? '').toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setStep('configure');\n }, []);\n\n const handleConfigure = useCallback(() => {\n if (!connectionName.trim()) {\n setErrorMessage('Connection name is required');\n return;\n }\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for storing or referencing credentials');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret to reuse');\n return;\n }\n setErrorMessage('');\n setStep('authenticate');\n }, [connectionName, credentialStorage]);\n\n const handleAuthenticate = useCallback(async () => {\n if (!selectedProvider) return;\n\n try {\n setErrorMessage('');\n\n // Build config — in botlit flow, embed returnTo + channelId for backend to use after OAuth completes\n const backendCallbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n\n const connectionConfig: Record<string, unknown> | undefined = isBotlitFlow\n ? { returnTo, channelId }\n : undefined;\n\n // First create the connection (or reuse existing if retrying after failed auth)\n const connId =\n createdConnectionId ??\n (await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim(),\n providerId: selectedProvider.id,\n vaultId: credentialStorage.vaultId,\n credentialSecretId:\n credentialStorage.mode === 'existing' ? credentialStorage.secretId : undefined,\n managedSecretName:\n credentialStorage.mode === 'managed'\n ? credentialStorage.managedSecretName.trim() || undefined\n : undefined,\n ...(connectionConfig ? { config: connectionConfig } : {}),\n }));\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n setStep('error');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Then authenticate based on auth type\n switch (selectedProvider.authType) {\n case 'oauth2': {\n // In botlit flow: redirect to backend callback so it can exchange token + redirect back.\n // In normal flow: use popup + polling pattern with same backend callback URL.\n const result = await initiateOAuth(connId, backendCallbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\n if (isBotlitFlow) {\n // Botlit flow: full-page redirect\n window.location.href = result.redirectUrl;\n return;\n } else {\n // Normal flow: open popup and poll for completion\n const width = 600;\n const height = 700;\n const left = window.screenX + (window.innerWidth - width) / 2;\n const top = window.screenY + (window.innerHeight - height) / 2;\n const popup = window.open(\n result.redirectUrl,\n 'oauth_popup',\n `width=${width},height=${height},left=${left},top=${top},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`\n );\n if (!popup) {\n setErrorMessage(\n 'Popup was blocked. Please allow popups for this site and try again.'\n );\n setStep('error');\n return;\n }\n oauthPopupRef.current = popup;\n setOauthWaiting(true);\n\n oauthCleanupRef.current?.();\n oauthCleanupRef.current = waitForOAuthPopupCompletion({\n connectionId: connId,\n popup,\n fetchConnectionStatus: async () => {\n const { data } = await fetchConnection({ variables: { id: connId } });\n return data?.getConnection ?? null;\n },\n onSuccess: () => {\n setStep('success');\n },\n onError: (message) => {\n setErrorMessage(message);\n setStep('error');\n },\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n }\n setStep('success');\n break;\n }\n case 'api_key':\n if (!apiKey.trim()) {\n setErrorMessage('API key is required');\n return;\n }\n await authenticateWithApiKey(connId, apiKey.trim());\n setStep('success');\n break;\n case 'basic_auth':\n if (!username.trim() || !password.trim()) {\n setErrorMessage('Username and password are required');\n return;\n }\n await authenticateWithBasicAuth(connId, username.trim(), password.trim());\n setStep('success');\n break;\n case 'bearer_token':\n if (!bearerToken.trim()) {\n setErrorMessage('Bearer token is required');\n return;\n }\n await authenticateWithBearerToken(connId, bearerToken.trim());\n setStep('success');\n break;\n default:\n setStep('success');\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Authentication failed');\n setStep('error');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n apiKey,\n username,\n password,\n bearerToken,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateWithApiKey,\n authenticateWithBasicAuth,\n authenticateWithBearerToken,\n isBotlitFlow,\n returnTo,\n channelId,\n apiGatewayUrl,\n createdConnectionId,\n credentialStorage,\n ]);\n\n const handleLinkToChannel = useCallback(() => {\n if (!returnTo || !createdConnectionId) return;\n // Use new URL() with origin base so relative returnTo URLs are handled correctly.\n // Always append both integrationConnectionId AND channelId so BotChannelsTab\n // can call linkIntegrationConnection(integrationConnectionId, channelId).\n const url = new URL(returnTo, window.location.origin);\n url.searchParams.set('integrationConnectionId', createdConnectionId);\n if (channelId) url.searchParams.set('channelId', channelId);\n // Intentionally use pathname+search only to prevent open-redirect vulnerability\n // if returnTo contains a cross-origin absolute URL (navigate only accepts path-relative URLs)\n navigate?.(url.pathname + url.search);\n }, [returnTo, createdConnectionId, channelId, navigate]);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || apiKeyLoading || basicAuthLoading || bearerLoading;\n const isPreselectedLoading = providerKey ? providerByKeyLoading : providersLoading;\n\n const steps = [\n { key: 'select_provider', label: 'Select Provider' },\n { key: 'configure', label: 'Configure' },\n { key: 'authenticate', label: 'Authenticate' },\n ];\n\n const currentStepIndex = steps.findIndex((s) => s.key === step);\n\n if (permissionsLoading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n </div>\n );\n }\n\n if (!canCreate) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-center p-6\">\n <Shield size={48} className=\"text-muted-foreground mb-4\" />\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Access Denied</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n You don't have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={16} /> Back to Connections\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl mx-auto\">\n {/* Header */}\n <div className=\"flex items-center gap-4\">\n <button\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </button>\n <h1 className=\"text-2xl font-bold text-foreground\">Add Connection</h1>\n {isBotlitFlow && (\n <span className=\"ml-auto text-xs font-medium px-2.5 py-1 rounded-full bg-primary/10 text-primary\">\n Bot Channel Setup\n </span>\n )}\n </div>\n\n {/* Step Indicator */}\n {step !== 'success' && step !== 'error' && (\n <div className=\"flex items-center gap-2\">\n {steps.map((s, i) => (\n <div key={s.key} className=\"flex items-center gap-2\">\n <div\n className={cn(\n 'w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all',\n i < currentStepIndex\n ? 'bg-primary text-primary-foreground'\n : i === currentStepIndex\n ? 'bg-primary text-primary-foreground ring-4 ring-primary/20'\n : 'bg-muted text-muted-foreground'\n )}\n >\n {i < currentStepIndex ? <Check size={16} /> : i + 1}\n </div>\n <span\n className={cn(\n 'text-sm font-medium hidden sm:inline',\n i === currentStepIndex ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {s.label}\n </span>\n {i < steps.length - 1 && <div className=\"w-8 h-px bg-border\" />}\n </div>\n ))}\n </div>\n )}\n\n {/* Error Banner */}\n {errorMessage && step !== 'error' && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-4 flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text flex-shrink-0\" />\n <p className=\"text-sm text-status-error-text\">{errorMessage}</p>\n </div>\n )}\n\n {/* Loading spinner while pre-selected provider resolves */}\n {step === 'configure' && isPreselectedLoading && !selectedProvider && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {/* Step 1: Select Provider */}\n {step === 'select_provider' && (\n <div className=\"space-y-4\">\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"text\"\n placeholder=\"Search installed providers...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n {providersLoading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {!providersLoading && filteredProviders.length === 0 && (\n <div className=\"text-center py-12\">\n <p className=\"text-muted-foreground\">\n No installed providers found. Install a provider from the catalog first.\n </p>\n <button\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Browse Catalog\n </button>\n </div>\n )}\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n {filteredProviders.map((provider: IntegrationProvider) => (\n <button\n key={provider.id}\n onClick={() => handleSelectProvider(provider)}\n className={cn(\n 'flex items-start gap-3 p-4 rounded-xl border border-border/50 bg-card text-left',\n 'hover:border-primary/50 hover:bg-accent/30 hover:shadow-md transition-all duration-200'\n )}\n >\n <ProviderIcon provider={provider} size={40} />\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-medium text-foreground truncate\">{provider.name}</h3>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {getCategoryLabel(provider.category)} · {getAuthTypeLabel(provider.authType)}\n </p>\n </div>\n </button>\n ))}\n </div>\n </div>\n )}\n\n {/* Step 2: Configure */}\n {step === 'configure' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"flex items-center gap-3 p-4 rounded-xl border border-border/50 bg-card\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <h3 className=\"font-medium text-foreground\">{selectedProvider.name}</h3>\n <p className=\"text-xs text-muted-foreground\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </div>\n\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"conn-name\" className=\"block text-sm font-semibold mb-2\">\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"conn-name\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder=\"e.g., My Slack Workspace\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"conn-desc\" className=\"block text-sm font-semibold mb-2\">\n Description\n </label>\n <textarea\n id=\"conn-desc\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n rows={3}\n placeholder=\"Optional description...\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n </div>\n\n <div className=\"flex gap-3\">\n <button\n onClick={() =>\n preselectedProviderId || providerKey\n ? navigate?.(joinPath(basePath, 'connections'))\n : setStep('select_provider')\n }\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Back\n </button>\n <button\n onClick={handleConfigure}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Next <ArrowRight size={16} />\n </button>\n </div>\n </div>\n )}\n\n {/* Step 3: Authenticate */}\n {step === 'authenticate' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-4\">\n <Shield size={18} className=\"text-primary\" />\n Authentication — {getAuthTypeLabel(selectedProvider.authType)}\n </h2>\n\n {selectedProvider.authType === 'oauth2' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n You will be redirected to {selectedProvider.name} to authorize access. After\n granting permission, you'll be redirected back.\n </p>\n <div className=\"p-3 rounded-lg bg-status-info-bg-subtle border border-border-default text-sm text-status-info-text flex items-center gap-2\">\n <ExternalLink size={16} />\n {isBotlitFlow\n ? `You'll be redirected back to the bot channel setup after authorization.`\n : `A new window will open for OAuth authentication`}\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'api_key' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} API key. You can typically find this in your\n account settings.\n </p>\n <div>\n <label htmlFor=\"api-key\" className=\"block text-sm font-semibold mb-2\">\n API Key <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"api-key\"\n value={apiKey}\n onChange={(e) => setApiKey(e.target.value)}\n placeholder=\"Enter your API key\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'basic_auth' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} credentials.\n </p>\n <div>\n <label htmlFor=\"username\" className=\"block text-sm font-semibold mb-2\">\n Username <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"username\"\n value={username}\n onChange={(e) => setUsername(e.target.value)}\n placeholder=\"Username or email\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"password\" className=\"block text-sm font-semibold mb-2\">\n Password <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Lock\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"password\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n placeholder=\"Password\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'bearer_token' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} bearer token.\n </p>\n <div>\n <label htmlFor=\"bearer-token\" className=\"block text-sm font-semibold mb-2\">\n Bearer Token <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"bearer-token\"\n value={bearerToken}\n onChange={(e) => setBearerToken(e.target.value)}\n placeholder=\"Enter your token\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex gap-3\">\n <button\n onClick={() => setStep('configure')}\n disabled={isAuthenticating}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50\"\n >\n Back\n </button>\n <button\n onClick={handleAuthenticate}\n disabled={isAuthenticating}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50\"\n >\n {isAuthenticating ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : (\n <Check size={16} />\n )}\n {selectedProvider.authType === 'oauth2' ? 'Authorize' : 'Connect'}\n </button>\n </div>\n </div>\n )}\n\n {/* Success */}\n {step === 'success' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Connection Created!</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n Your {selectedProvider?.name} connection has been set up successfully.\n </p>\n <div className=\"flex gap-3\">\n {/* Botlit flow: primary action is linking back to the channel */}\n {isBotlitFlow && createdConnectionId && (\n <button\n onClick={handleLinkToChannel}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Link size={16} />\n Link to Bot Channel\n </button>\n )}\n {/* Normal flow: view the newly created connection */}\n {!isBotlitFlow && createdConnectionId && (\n <button\n onClick={() => navigate?.(joinPath(basePath, `connections/${createdConnectionId}`))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n View Connection\n </button>\n )}\n <button\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n All Connections\n </button>\n </div>\n </div>\n )}\n\n {/* Error */}\n {step === 'error' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-error-bg-subtle mb-4\">\n <AlertCircle size={48} className=\"text-status-error-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Connection Failed</h2>\n <p className=\"text-sm text-status-error-text mb-6 max-w-sm\">\n {errorMessage || 'An unexpected error occurred.'}\n </p>\n <div className=\"flex gap-3\">\n <button\n onClick={() => {\n setErrorMessage('');\n setStep('authenticate');\n }}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Try Again\n </button>\n <button\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqDA,SAAgB,IAAsB;CACpC,IAAM,EAAE,YAAY,MAA0B,IAAmC,EAC3E,EAAE,cAAW,KAAK,aAAU,qBAAkB,GAAiB,EAC/D,KAAW,IAAa,EAGxB,IAAe,QAAc,IAAI,gBAAgB,GAAS,OAAO,EAAE,CAAC,GAAS,OAAO,CAAC,EACrF,IAAc,EAAa,IAAI,cAAc,IAAI,MACjD,IAAW,EAAa,IAAI,WAAW,IAAI,MAC3C,IAAY,EAAa,IAAI,YAAY,IAAI,MAC7C,IAAe,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X;OAEQ,CAAA,CACL;;KACF;;GAEJ;MAxaJ,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,IAAD;IAAQ,MAAM;IAAI,WAAU;IAA+B,CAAA;GAC3D,kBAAC,MAAD;IAAI,WAAU;cAAyC;IAAkB,CAAA;GACzE,kBAAC,KAAD;IAAG,WAAU;cAA8C;IAEvD,CAAA;GACJ,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,IAAW,EAAS,GAAU,cAAc,CAAC;IAC5D,WAAU;cAHZ,CAKE,kBAAC,IAAD,EAAW,MAAM,IAAM,CAAA,EAAA,uBAChB;;GACL"}
|
|
1
|
+
{"version":3,"file":"AddConnectionWizard.js","names":[],"sources":["../../../src/integrations/pages/AddConnectionWizard.tsx"],"sourcesContent":["import { useState, useMemo, useCallback, useEffect, useRef } from 'react';\nimport { useParams, useLocation } from 'react-router-dom';\nimport {\n ArrowLeft,\n ArrowRight,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n Key,\n Lock,\n Shield,\n ExternalLink,\n Link,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { joinPath } from '../utils/navigation';\nimport { getAuthTypeLabel, getCategoryLabel } from '../utils/integrationsHelpers';\nimport { useProviders, useProviderByKey } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateWithApiKey,\n useAuthenticateWithBasicAuth,\n useAuthenticateWithBearerToken,\n} from '../hooks/useConnections';\nimport { useGetConnectionLazyQuery } from '../../generated/wspace-operations';\nimport { waitForOAuthPopupCompletion } from '../utils/oauthPopup';\nimport {\n CredentialStorageSelector,\n type CredentialStorageState,\n} from '../components/CredentialStorageSelector';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport type { IntegrationProvider } from '../types';\n\ntype WizardStep = 'select_provider' | 'configure' | 'authenticate' | 'success' | 'error';\n\n/**\n * Add Connection Wizard — multi-step wizard for creating new connections.\n *\n * Supports an optional \"botlit channel flow\" activated by URL search params:\n * ?providerKey=slack-user&returnTo=<url>&channelId=<id>\n *\n * In this flow:\n * - The provider is pre-selected by key (not UUID) and the wizard skips directly to configure.\n * - OAuth redirectUri is set to the backend callback so the backend can exchange the token\n * and redirect back to `returnTo?integrationConnectionId=<id>`.\n * - On success, a \"Link to bot channel\" button navigates to returnTo with the connectionId.\n */\nexport function AddConnectionWizard() {\n const { providerId: preselectedProviderId } = useParams<{ providerId: string }>();\n const { basePath = '/', navigate, apiGatewayUrl } = useIntegrations();\n const routerLocation = useLocation();\n const routerSearch = routerLocation.search;\n\n // ── Parse botlit flow query params ──────────────────────────────────────────\n const searchParams = useMemo(() => new URLSearchParams(routerSearch), [routerSearch]);\n const providerKey = searchParams.get('providerKey') ?? null;\n const returnTo = searchParams.get('returnTo') ?? null;\n const channelId = searchParams.get('channelId') ?? null;\n const isBotlitFlow = Boolean(returnTo && channelId);\n\n // If providerKey is present, look up by key; otherwise fall back to preselectedProviderId (UUID)\n const { provider: providerByKey, loading: providerByKeyLoading } = useProviderByKey(\n providerKey ?? ''\n );\n\n const { providers, loading: providersLoading } = useProviders();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateWithApiKey, loading: apiKeyLoading } = useAuthenticateWithApiKey();\n const { authenticateWithBasicAuth, loading: basicAuthLoading } = useAuthenticateWithBasicAuth();\n const { authenticateWithBearerToken, loading: bearerLoading } = useAuthenticateWithBearerToken();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Wizard state\n const initialStep: WizardStep =\n preselectedProviderId || providerKey ? 'configure' : 'select_provider';\n const [step, setStep] = useState<WizardStep>(initialStep);\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Form state\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n const [apiKey, setApiKey] = useState('');\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [bearerToken, setBearerToken] = useState('');\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n\n const [errorMessage, setErrorMessage] = useState('');\n const [createdConnectionId, setCreatedConnectionId] = useState<string | null>(null);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n\n // Cleanup OAuth listener and popup on unmount.\n useEffect(() => {\n return () => {\n oauthCleanupRef.current?.();\n if (oauthPopupRef.current && !oauthPopupRef.current.closed) {\n oauthPopupRef.current.close();\n }\n };\n }, []);\n\n // Find pre-selected provider by UUID (existing flow)\n const preselectedProvider = useMemo(() => {\n if (!preselectedProviderId || !providers) return null;\n return providers.find((p: IntegrationProvider) => p.id === preselectedProviderId) || null;\n }, [preselectedProviderId, providers]);\n\n // Determine effective preselected provider — by key (botlit flow) or by UUID (existing flow)\n const effectivePreselectedProvider = useMemo(\n () => providerByKey ?? preselectedProvider,\n [providerByKey, preselectedProvider]\n );\n\n // Set provider on first load if preselected (both flows)\n useEffect(() => {\n if (effectivePreselectedProvider && !selectedProvider && step === 'configure') {\n setSelectedProvider(effectivePreselectedProvider);\n if (!connectionName) {\n setConnectionName(`${effectivePreselectedProvider.name} Connection`);\n }\n }\n }, [effectivePreselectedProvider, selectedProvider, step, connectionName]);\n\n // Filter providers for selection step\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) || (p.description ?? '').toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setStep('configure');\n }, []);\n\n const handleConfigure = useCallback(() => {\n if (!connectionName.trim()) {\n setErrorMessage('Connection name is required');\n return;\n }\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for storing or referencing credentials');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret to reuse');\n return;\n }\n setErrorMessage('');\n setStep('authenticate');\n }, [connectionName, credentialStorage]);\n\n const handleAuthenticate = useCallback(async () => {\n if (!selectedProvider) return;\n\n try {\n setErrorMessage('');\n\n // Build config — in botlit flow, embed returnTo + channelId for backend to use after OAuth completes\n const backendCallbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n\n const connectionConfig: Record<string, unknown> | undefined = isBotlitFlow\n ? { returnTo, channelId }\n : undefined;\n\n // First create the connection (or reuse existing if retrying after failed auth)\n const connId =\n createdConnectionId ??\n (await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim(),\n providerId: selectedProvider.id,\n vaultId: credentialStorage.vaultId,\n credentialSecretId:\n credentialStorage.mode === 'existing' ? credentialStorage.secretId : undefined,\n managedSecretName:\n credentialStorage.mode === 'managed'\n ? credentialStorage.managedSecretName.trim() || undefined\n : undefined,\n ...(connectionConfig ? { config: connectionConfig } : {}),\n }));\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n setStep('error');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Then authenticate based on auth type\n switch (selectedProvider.authType) {\n case 'oauth2': {\n // In botlit flow: redirect to backend callback so it can exchange token + redirect back.\n // In normal flow: use popup + polling pattern with same backend callback URL.\n const result = await initiateOAuth(connId, backendCallbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\n if (isBotlitFlow) {\n // Botlit flow: full-page redirect\n window.location.href = result.redirectUrl;\n return;\n } else {\n // Normal flow: open popup and poll for completion\n const width = 600;\n const height = 700;\n const left = window.screenX + (window.innerWidth - width) / 2;\n const top = window.screenY + (window.innerHeight - height) / 2;\n const popup = window.open(\n result.redirectUrl,\n 'oauth_popup',\n `width=${width},height=${height},left=${left},top=${top},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`\n );\n if (!popup) {\n setErrorMessage(\n 'Popup was blocked. Please allow popups for this site and try again.'\n );\n setStep('error');\n return;\n }\n oauthPopupRef.current = popup;\n setOauthWaiting(true);\n\n oauthCleanupRef.current?.();\n oauthCleanupRef.current = waitForOAuthPopupCompletion({\n connectionId: connId,\n popup,\n fetchConnectionStatus: async () => {\n const { data } = await fetchConnection({ variables: { id: connId } });\n return data?.getConnection ?? null;\n },\n onSuccess: () => {\n setStep('success');\n },\n onError: (message) => {\n setErrorMessage(message);\n setStep('error');\n },\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n }\n setStep('success');\n break;\n }\n case 'api_key':\n if (!apiKey.trim()) {\n setErrorMessage('API key is required');\n return;\n }\n await authenticateWithApiKey(connId, apiKey.trim());\n setStep('success');\n break;\n case 'basic_auth':\n if (!username.trim() || !password.trim()) {\n setErrorMessage('Username and password are required');\n return;\n }\n await authenticateWithBasicAuth(connId, username.trim(), password.trim());\n setStep('success');\n break;\n case 'bearer_token':\n if (!bearerToken.trim()) {\n setErrorMessage('Bearer token is required');\n return;\n }\n await authenticateWithBearerToken(connId, bearerToken.trim());\n setStep('success');\n break;\n default:\n setStep('success');\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Authentication failed');\n setStep('error');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n apiKey,\n username,\n password,\n bearerToken,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateWithApiKey,\n authenticateWithBasicAuth,\n authenticateWithBearerToken,\n isBotlitFlow,\n returnTo,\n channelId,\n apiGatewayUrl,\n createdConnectionId,\n credentialStorage,\n ]);\n\n const handleLinkToChannel = useCallback(() => {\n if (!returnTo || !createdConnectionId) return;\n // Use new URL() with origin base so relative returnTo URLs are handled correctly.\n // Always append both integrationConnectionId AND channelId so BotChannelsTab\n // can call linkIntegrationConnection(integrationConnectionId, channelId).\n const url = new URL(returnTo, window.location.origin);\n url.searchParams.set('integrationConnectionId', createdConnectionId);\n if (channelId) url.searchParams.set('channelId', channelId);\n // Intentionally use pathname+search only to prevent open-redirect vulnerability\n // if returnTo contains a cross-origin absolute URL (navigate only accepts path-relative URLs)\n navigate?.(url.pathname + url.search);\n }, [returnTo, createdConnectionId, channelId, navigate]);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || apiKeyLoading || basicAuthLoading || bearerLoading;\n const isPreselectedLoading = providerKey ? providerByKeyLoading : providersLoading;\n\n const steps = [\n { key: 'select_provider', label: 'Select Provider' },\n { key: 'configure', label: 'Configure' },\n { key: 'authenticate', label: 'Authenticate' },\n ];\n\n const currentStepIndex = steps.findIndex((s) => s.key === step);\n\n if (permissionsLoading) {\n return (\n <div className=\"flex items-center justify-center py-20\">\n <Loader2 size={48} className=\"animate-spin text-primary\" />\n </div>\n );\n }\n\n if (!canCreate) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20 text-center p-6\">\n <Shield size={48} className=\"text-muted-foreground mb-4\" />\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Access Denied</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n You don't have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={16} /> Back to Connections\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl mx-auto\">\n {/* Header */}\n <div className=\"flex items-center gap-4\">\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"p-2.5 hover:bg-accent rounded-lg transition-all\"\n aria-label=\"Back\"\n >\n <ArrowLeft size={20} />\n </button>\n <h1 className=\"text-2xl font-bold text-foreground\">Add Connection</h1>\n {isBotlitFlow && (\n <span className=\"ml-auto text-xs font-medium px-2.5 py-1 rounded-full bg-primary/10 text-primary\">\n Bot Channel Setup\n </span>\n )}\n </div>\n\n {/* Step Indicator */}\n {step !== 'success' && step !== 'error' && (\n <div className=\"flex items-center gap-2\">\n {steps.map((s, i) => (\n <div key={s.key} className=\"flex items-center gap-2\">\n <div\n className={cn(\n 'w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all',\n i < currentStepIndex\n ? 'bg-primary text-primary-foreground'\n : i === currentStepIndex\n ? 'bg-primary text-primary-foreground ring-4 ring-primary/20'\n : 'bg-muted text-muted-foreground'\n )}\n >\n {i < currentStepIndex ? <Check size={16} /> : i + 1}\n </div>\n <span\n className={cn(\n 'text-sm font-medium hidden sm:inline',\n i === currentStepIndex ? 'text-foreground' : 'text-muted-foreground'\n )}\n >\n {s.label}\n </span>\n {i < steps.length - 1 && <div className=\"w-8 h-px bg-border\" />}\n </div>\n ))}\n </div>\n )}\n\n {/* Error Banner */}\n {errorMessage && step !== 'error' && (\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-4 flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text flex-shrink-0\" />\n <p className=\"text-sm text-status-error-text\">{errorMessage}</p>\n </div>\n )}\n\n {/* Loading spinner while pre-selected provider resolves */}\n {step === 'configure' && isPreselectedLoading && !selectedProvider && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {/* Step 1: Select Provider */}\n {step === 'select_provider' && (\n <div className=\"space-y-4\">\n <div className=\"relative group\">\n <Search\n size={18}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"text\"\n placeholder=\"Search installed providers...\"\n aria-label=\"Search installed providers\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n {providersLoading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-muted-foreground\" />\n </div>\n )}\n\n {!providersLoading && filteredProviders.length === 0 && (\n <div className=\"text-center py-12\">\n <p className=\"text-muted-foreground\">\n No installed providers found. Install a provider from the catalog first.\n </p>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n className=\"mt-4 inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Browse Catalog\n </button>\n </div>\n )}\n\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n {filteredProviders.map((provider: IntegrationProvider) => (\n <button\n type=\"button\"\n key={provider.id}\n onClick={() => handleSelectProvider(provider)}\n className={cn(\n 'flex items-start gap-3 p-4 rounded-xl border border-border/50 bg-card text-left',\n 'hover:border-primary/50 hover:bg-accent/30 hover:shadow-md transition-all duration-200'\n )}\n >\n <ProviderIcon provider={provider} size={40} />\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-medium text-foreground truncate\">{provider.name}</h3>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {getCategoryLabel(provider.category)} · {getAuthTypeLabel(provider.authType)}\n </p>\n </div>\n </button>\n ))}\n </div>\n </div>\n )}\n\n {/* Step 2: Configure */}\n {step === 'configure' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"flex items-center gap-3 p-4 rounded-xl border border-border/50 bg-card\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <h3 className=\"font-medium text-foreground\">{selectedProvider.name}</h3>\n <p className=\"text-xs text-muted-foreground\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </div>\n\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"conn-name\" className=\"block text-sm font-semibold mb-2\">\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"conn-name\"\n aria-label=\"Connection Name\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder=\"e.g., My Slack Workspace\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"conn-desc\" className=\"block text-sm font-semibold mb-2\">\n Description\n </label>\n <textarea\n id=\"conn-desc\"\n aria-label=\"Description\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n rows={3}\n placeholder=\"Optional description...\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n </div>\n\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() =>\n preselectedProviderId || providerKey\n ? navigate?.(joinPath(basePath, 'connections'))\n : setStep('select_provider')\n }\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Back\n </button>\n <button\n type=\"button\"\n onClick={handleConfigure}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Next <ArrowRight size={16} />\n </button>\n </div>\n </div>\n )}\n\n {/* Step 3: Authenticate */}\n {step === 'authenticate' && selectedProvider && (\n <div className=\"space-y-6\">\n <div className=\"rounded-xl border border-border/50 bg-card p-5\">\n <h2 className=\"font-semibold text-foreground flex items-center gap-2 mb-4\">\n <Shield size={18} className=\"text-primary\" />\n Authentication: {getAuthTypeLabel(selectedProvider.authType)}\n </h2>\n\n {selectedProvider.authType === 'oauth2' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n You will be redirected to {selectedProvider.name} to authorize access. After\n granting permission, you'll be redirected back.\n </p>\n <div className=\"p-3 rounded-lg bg-status-info-bg-subtle border border-border-default text-sm text-status-info-text flex items-center gap-2\">\n <ExternalLink size={16} />\n {isBotlitFlow\n ? `You'll be redirected back to the bot channel setup after authorization.`\n : `A new window will open for OAuth authentication`}\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'api_key' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} API key. You can typically find this in your\n account settings.\n </p>\n <div>\n <label htmlFor=\"api-key\" className=\"block text-sm font-semibold mb-2\">\n API Key <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"api-key\"\n aria-label=\"API Key\"\n value={apiKey}\n onChange={(e) => setApiKey(e.target.value)}\n placeholder=\"Enter your API key\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'basic_auth' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} credentials.\n </p>\n <div>\n <label htmlFor=\"username\" className=\"block text-sm font-semibold mb-2\">\n Username <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n id=\"username\"\n aria-label=\"Username\"\n value={username}\n onChange={(e) => setUsername(e.target.value)}\n placeholder=\"Username or email\"\n className=\"w-full px-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n <div>\n <label htmlFor=\"password\" className=\"block text-sm font-semibold mb-2\">\n Password <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Lock\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"password\"\n aria-label=\"Password\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n placeholder=\"Password\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n\n {selectedProvider.authType === 'bearer_token' && (\n <div className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">\n Enter your {selectedProvider.name} bearer token.\n </p>\n <div>\n <label htmlFor=\"bearer-token\" className=\"block text-sm font-semibold mb-2\">\n Bearer Token <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <Key\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground\"\n />\n <input\n type=\"password\"\n id=\"bearer-token\"\n aria-label=\"Bearer Token\"\n value={bearerToken}\n onChange={(e) => setBearerToken(e.target.value)}\n placeholder=\"Enter your token\"\n className=\"w-full pl-10 pr-4 py-2.5 border border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n </div>\n </div>\n )}\n </div>\n\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() => setStep('configure')}\n disabled={isAuthenticating}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50\"\n >\n Back\n </button>\n <button\n type=\"button\"\n onClick={handleAuthenticate}\n disabled={isAuthenticating}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50\"\n >\n {isAuthenticating ? (\n <Loader2 size={16} className=\"animate-spin\" />\n ) : (\n <Check size={16} />\n )}\n {selectedProvider.authType === 'oauth2' ? 'Authorize' : 'Connect'}\n </button>\n </div>\n </div>\n )}\n\n {/* Success */}\n {step === 'success' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Connection Created!</h2>\n <p className=\"text-sm text-muted-foreground mb-6 max-w-sm\">\n Your {selectedProvider?.name} connection has been set up successfully.\n </p>\n <div className=\"flex gap-3\">\n {/* Botlit flow: primary action is linking back to the channel */}\n {isBotlitFlow && createdConnectionId && (\n <button\n type=\"button\"\n onClick={handleLinkToChannel}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n <Link size={16} />\n Link to Bot Channel\n </button>\n )}\n {/* Normal flow: view the newly created connection */}\n {!isBotlitFlow && createdConnectionId && (\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, `connections/${createdConnectionId}`))}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n View Connection\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n All Connections\n </button>\n </div>\n </div>\n )}\n\n {/* Error */}\n {step === 'error' && (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"p-4 rounded-full bg-status-error-bg-subtle mb-4\">\n <AlertCircle size={48} className=\"text-status-error-text\" />\n </div>\n <h2 className=\"text-xl font-bold text-foreground mb-2\">Connection Failed</h2>\n <p className=\"text-sm text-status-error-text mb-6 max-w-sm\">\n {errorMessage || 'An unexpected error occurred.'}\n </p>\n <div className=\"flex gap-3\">\n <button\n type=\"button\"\n onClick={() => {\n setErrorMessage('');\n setStep('authenticate');\n }}\n className=\"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors\"\n >\n Try Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'connections'))}\n className=\"px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAqDA,SAAgB,IAAsB;CACpC,IAAM,EAAE,YAAY,MAA0B,IAAmC,EAC3E,EAAE,cAAW,KAAK,aAAU,qBAAkB,GAAiB,EAE/D,KADiB,IAAa,CACA,QAG9B,IAAe,QAAc,IAAI,gBAAgB,GAAa,EAAE,CAAC,GAAa,CAAC,EAC/E,IAAc,EAAa,IAAI,cAAc,IAAI,MACjD,IAAW,EAAa,IAAI,WAAW,IAAI,MAC3C,IAAY,EAAa,IAAI,YAAY,IAAI,MAC7C,IAAe,GAAQ,KAAY,IAGnC,EAAE,UAAU,GAAe,SAAS,OAAyB,GACjE,KAAe,GAChB,EAEK,EAAE,cAAW,SAAS,MAAqB,IAAc,EACzD,EAAE,mBAAe,WAAW,OAAuB,IAAgB,EACnE,KAAY,GAAc,EAAwB,kBAAkB,EACpE,EAAE,qBAAkB,SAAS,OAAa,IAAqB,EAC/D,EAAE,kBAAe,SAAS,OAAiB,IAAkB,EAC7D,EAAE,2BAAwB,SAAS,OAAkB,IAA2B,EAChF,EAAE,8BAA2B,SAAS,OAAqB,IAA8B,EACzF,EAAE,gCAA6B,SAAS,OAAkB,IAAgC,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