@burdenoff/microfe-integrations 2026.525.3 → 2026.527.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integrations/IntegrationsAdminRoutes.js +4 -3
- package/dist/integrations/IntegrationsAdminRoutes.js.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.js +4 -3
- package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +7 -4
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/ProviderCard.js +2 -0
- package/dist/integrations/components/ProviderCard.js.map +1 -1
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/hooks/useLogs.js.map +1 -1
- package/dist/integrations/hooks/useProviders.js.map +1 -1
- package/dist/integrations/pages/AddConnectionWizard.js +14 -2
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.js +8 -1
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionLogs.js +9 -1
- package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.js +11 -2
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.js +11 -5
- package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
- package/dist/integrations/pages/IntegrationsSettings.js +6 -2
- package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
- package/dist/integrations/pages/ProviderCatalog.js +9 -2
- package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.js +13 -2
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/pages/ProviderEditorPage.js +174 -172
- package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
- package/dist/integrations/providers/IntegrationsProvider.js +1 -1
- package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
- package/dist/integrations/utils/constants.js.map +1 -1
- package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -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":";;;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C5D,gBAAgB;EAAC;EAAgB;EAAe;EAAqB,EACtE,CAAC;AAiCF,QAAO;EAAE,cA/BY,EACnB,OACE,GACA,OAsBe,MAAM,EAAO,EAAE,WAAW;GAAE;GAAI;GAAO,EAAE,CAAC,EAC3C,MAAM,sBAEtB,CAAC,EAAO,CACT;EAEsB;EAAS;;AAGlC,SAAgB,IAAqB;CACnC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAAmC,EAC/D,gBAAgB;EAAC;EAAgB;EAAe;EAAqB,EACtE,CAAC;AAUF,QAAO;EAAE,iBARe,EACtB,OAAO,OACU,MAAM,EAAO,EAAE,WAAW,EAAE,OAAI,EAAE,CAAC,EACpC,MAAM,yBAEtB,CAAC,EAAO,CACT;EAEyB;EAAS;;AAGrC,SAAgB,IAAoB;CAClC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAA0B,EACtD,gBAAgB,CAAC,gBAAgB,cAAc,EAChD,CAAC;AAUF,QAAO;EAAE,gBARc,EACrB,OAAO,OACU,MAAM,EAAO,EAAE,WAAW,EAAE,OAAI,EAAE,CAAC,EACpC,MAAM,gBAEtB,CAAC,EAAO,CACT;EAEwB;EAAS;;AAGpC,SAAgB,IAAqB;CACnC,IAAM,CAAC,GAAQ,EAAE,gBAAa,EAA2B,EACvD,gBAAgB,CAAC,gBAAgB,cAAc,EAChD,CAAC;AAUF,QAAO;EAAE,iBARe,EACtB,OAAO,OACU,MAAM,EAAO,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",
|
|
@@ -268,6 +269,7 @@ function h() {
|
|
|
268
269
|
className: "text-muted-foreground",
|
|
269
270
|
children: "No installed providers found. Install a provider from the catalog first."
|
|
270
271
|
}), /* @__PURE__ */ p("button", {
|
|
272
|
+
type: "button",
|
|
271
273
|
onClick: () => _?.(r(g, "providers")),
|
|
272
274
|
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
275
|
children: "Browse Catalog"
|
|
@@ -276,6 +278,7 @@ function h() {
|
|
|
276
278
|
/* @__PURE__ */ p("div", {
|
|
277
279
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-3",
|
|
278
280
|
children: Ke.map((e) => /* @__PURE__ */ m("button", {
|
|
281
|
+
type: "button",
|
|
279
282
|
onClick: () => qe(e),
|
|
280
283
|
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
284
|
children: [/* @__PURE__ */ p(a, {
|
|
@@ -355,10 +358,12 @@ function h() {
|
|
|
355
358
|
/* @__PURE__ */ m("div", {
|
|
356
359
|
className: "flex gap-3",
|
|
357
360
|
children: [/* @__PURE__ */ p("button", {
|
|
361
|
+
type: "button",
|
|
358
362
|
onClick: () => h || b ? _?.(r(g, "connections")) : P("select_provider"),
|
|
359
363
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
360
364
|
children: "Back"
|
|
361
365
|
}), /* @__PURE__ */ m("button", {
|
|
366
|
+
type: "button",
|
|
362
367
|
onClick: Je,
|
|
363
368
|
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
369
|
children: ["Next ", /* @__PURE__ */ p(fe, { size: 16 })]
|
|
@@ -378,7 +383,7 @@ function h() {
|
|
|
378
383
|
size: 18,
|
|
379
384
|
className: "text-primary"
|
|
380
385
|
}),
|
|
381
|
-
"Authentication
|
|
386
|
+
"Authentication: ",
|
|
382
387
|
i(F.authType)
|
|
383
388
|
]
|
|
384
389
|
}),
|
|
@@ -511,11 +516,13 @@ function h() {
|
|
|
511
516
|
}), /* @__PURE__ */ m("div", {
|
|
512
517
|
className: "flex gap-3",
|
|
513
518
|
children: [/* @__PURE__ */ p("button", {
|
|
519
|
+
type: "button",
|
|
514
520
|
onClick: () => P("configure"),
|
|
515
521
|
disabled: Z,
|
|
516
522
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50",
|
|
517
523
|
children: "Back"
|
|
518
524
|
}), /* @__PURE__ */ m("button", {
|
|
525
|
+
type: "button",
|
|
519
526
|
onClick: Ye,
|
|
520
527
|
disabled: Z,
|
|
521
528
|
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 +559,19 @@ function h() {
|
|
|
552
559
|
className: "flex gap-3",
|
|
553
560
|
children: [
|
|
554
561
|
C && q && /* @__PURE__ */ m("button", {
|
|
562
|
+
type: "button",
|
|
555
563
|
onClick: Xe,
|
|
556
564
|
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
565
|
children: [/* @__PURE__ */ p(_e, { size: 16 }), "Link to Bot Channel"]
|
|
558
566
|
}),
|
|
559
567
|
!C && q && /* @__PURE__ */ p("button", {
|
|
568
|
+
type: "button",
|
|
560
569
|
onClick: () => _?.(r(g, `connections/${q}`)),
|
|
561
570
|
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
571
|
children: "View Connection"
|
|
563
572
|
}),
|
|
564
573
|
/* @__PURE__ */ p("button", {
|
|
574
|
+
type: "button",
|
|
565
575
|
onClick: () => _?.(r(g, "connections")),
|
|
566
576
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
567
577
|
children: "All Connections"
|
|
@@ -591,12 +601,14 @@ function h() {
|
|
|
591
601
|
/* @__PURE__ */ m("div", {
|
|
592
602
|
className: "flex gap-3",
|
|
593
603
|
children: [/* @__PURE__ */ p("button", {
|
|
604
|
+
type: "button",
|
|
594
605
|
onClick: () => {
|
|
595
606
|
K(""), P("authenticate");
|
|
596
607
|
},
|
|
597
608
|
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
609
|
children: "Try Again"
|
|
599
610
|
}), /* @__PURE__ */ p("button", {
|
|
611
|
+
type: "button",
|
|
600
612
|
onClick: () => _?.(r(g, "connections")),
|
|
601
613
|
className: "px-4 py-2.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
602
614
|
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,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,EAC1F,CAAC,KAAmB,GAA0B,EAAE,aAAa,gBAAgB,CAAC,EAK9E,CAAC,GAAM,KAAW,EADtB,KAAyB,IAAc,cAAc,kBACE,EACnD,CAAC,GAAkB,MAAuB,EAAqC,KAAK,EACpF,CAAC,GAAa,MAAkB,EAAS,GAAG,EAG5C,CAAC,GAAgB,KAAqB,EAAS,GAAG,EAClD,CAAC,GAAuB,MAA4B,EAAS,GAAG,EAChE,CAAC,GAAQ,MAAa,EAAS,GAAG,EAClC,CAAC,G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AAc,CAAC;QAC5D,WAAU;kBACX;QAEQ,CAAA;OACL;;KACF;;GAIP,MAAS,WACR,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,GAAD;OAAa,MAAM;OAAI,WAAU;OAA2B,CAAA;MACxD,CAAA;KACN,kBAAC,MAAD;MAAI,WAAU;gBAAyC;MAAsB,CAAA;KAC7E,kBAAC,KAAD;MAAG,WAAU;gBACV,KAAgB;MACf,CAAA;KACJ,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,UAAD;OACE,eAAe;AAEb,QADA,EAAgB,GAAG,EACnB,EAAQ,eAAe;;OAEzB,WAAU;iBACX;OAEQ,CAAA,EACT,kBAAC,UAAD;OACE,eAAe,IAAW,EAAS,GAAU,cAAc,CAAC;OAC5D,WAAU;iBACX;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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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,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B,GAAG,EACnB,EAAQ,eAAe;;OAEzB,WAAU;iBACX;OAEQ,CAAA,EACT,kBAAC,UAAD;OAAQ,MAAK;OACX,eAAe,IAAW,EAAS,GAAU,cAAc,CAAC;OAC5D,WAAU;iBACX;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"}
|
|
@@ -57,6 +57,7 @@ function C() {
|
|
|
57
57
|
/* @__PURE__ */ S("div", {
|
|
58
58
|
className: "flex gap-2",
|
|
59
59
|
children: [/* @__PURE__ */ S("button", {
|
|
60
|
+
type: "button",
|
|
60
61
|
onClick: () => j(),
|
|
61
62
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors",
|
|
62
63
|
children: [
|
|
@@ -65,6 +66,7 @@ function C() {
|
|
|
65
66
|
D("integrations.connectionDetail.error.retry", "Try Again")
|
|
66
67
|
]
|
|
67
68
|
}), /* @__PURE__ */ S("button", {
|
|
69
|
+
type: "button",
|
|
68
70
|
onClick: () => T?.(r(w, "connections")),
|
|
69
71
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors",
|
|
70
72
|
children: [
|
|
@@ -185,6 +187,7 @@ function C() {
|
|
|
185
187
|
className: "relative z-10 flex items-center gap-4",
|
|
186
188
|
children: [
|
|
187
189
|
/* @__PURE__ */ x("button", {
|
|
190
|
+
type: "button",
|
|
188
191
|
onClick: () => T?.(r(w, "connections")),
|
|
189
192
|
className: "p-2.5 hover:bg-accent rounded-lg transition-all",
|
|
190
193
|
"aria-label": D("integrations.connectionDetail.actions.backAriaLabel", "Back"),
|
|
@@ -215,7 +218,7 @@ function C() {
|
|
|
215
218
|
})]
|
|
216
219
|
})
|
|
217
220
|
]
|
|
218
|
-
}), /* @__PURE__ */ x("div", { className: "absolute top-0 right-0
|
|
221
|
+
}), /* @__PURE__ */ x("div", { className: "absolute top-0 right-0 size-64 bg-gradient-to-br from-primary/10 to-transparent rounded-full blur-3xl -z-0" })]
|
|
219
222
|
}),
|
|
220
223
|
/* @__PURE__ */ S("div", {
|
|
221
224
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
@@ -419,6 +422,7 @@ function C() {
|
|
|
419
422
|
className: "flex flex-wrap gap-2",
|
|
420
423
|
children: [
|
|
421
424
|
/* @__PURE__ */ S("button", {
|
|
425
|
+
type: "button",
|
|
422
426
|
onClick: we,
|
|
423
427
|
disabled: Q,
|
|
424
428
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",
|
|
@@ -428,6 +432,7 @@ function C() {
|
|
|
428
432
|
}) : /* @__PURE__ */ x(pe, { size: 14 }), D("integrations.connectionDetail.actions.test", "Test Connection")]
|
|
429
433
|
}),
|
|
430
434
|
B && O.provider.authType === "oauth2" && ye && /* @__PURE__ */ S("button", {
|
|
435
|
+
type: "button",
|
|
431
436
|
onClick: Te,
|
|
432
437
|
disabled: Q,
|
|
433
438
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border hover:bg-accent transition-colors disabled:opacity-50",
|
|
@@ -437,6 +442,7 @@ function C() {
|
|
|
437
442
|
}) : /* @__PURE__ */ x(de, { size: 14 }), D("integrations.connectionDetail.actions.refreshToken", "Refresh Token")]
|
|
438
443
|
}),
|
|
439
444
|
V && /* @__PURE__ */ S("button", {
|
|
445
|
+
type: "button",
|
|
440
446
|
onClick: Ee,
|
|
441
447
|
disabled: Q,
|
|
442
448
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-default text-status-warning-text hover:bg-status-warning-bg-subtle transition-colors disabled:opacity-50",
|
|
@@ -446,6 +452,7 @@ function C() {
|
|
|
446
452
|
}) : /* @__PURE__ */ x(v, { size: 14 }), D("integrations.connectionDetail.actions.revoke", "Revoke")]
|
|
447
453
|
}),
|
|
448
454
|
V && /* @__PURE__ */ S("button", {
|
|
455
|
+
type: "button",
|
|
449
456
|
onClick: De,
|
|
450
457
|
disabled: Q,
|
|
451
458
|
className: "inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-default text-status-error-text hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50",
|