diff --git a/components/workflow/config/action-config.tsx b/components/workflow/config/action-config.tsx index 077ea610a..8a1d7f6dc 100644 --- a/components/workflow/config/action-config.tsx +++ b/components/workflow/config/action-config.tsx @@ -26,6 +26,9 @@ import { TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; +// start keeperhub +import { integrationRequiresCredentials } from "@/keeperhub/lib/integration-helpers"; +// end keeperhub import { aiGatewayStatusAtom } from "@/lib/ai-gateway/state"; import { integrationsAtom, @@ -393,6 +396,14 @@ export function ActionConfig({ return action?.integration as IntegrationType | undefined; }, [actionType]); + // start keeperhub + // Check if integration requires credentials (some like web3 don't) + const requiresCredentials = useMemo( + () => integrationRequiresCredentials(integrationType), + [integrationType] + ); + // end keeperhub + // Check if AI Gateway managed keys should be offered (user can have multiple for different teams) const shouldUseManagedKeys = integrationType === "ai-gateway" && @@ -496,7 +507,8 @@ export function ActionConfig({ - {integrationType && isOwner && ( + {/* start keeperhub - added requiresCredentials check (upstream: integrationType && isOwner) */} + {integrationType && isOwner && requiresCredentials && (
@@ -532,6 +544,7 @@ export function ActionConfig({ />
)} + {/* end keeperhub */} {/* System actions - hardcoded config fields */} { Delete
- - {/* KeeperHub: Integration selector in footer */} - {selectedNode.data.type === "action" && - (() => { - const actionType = selectedNode.data.config - ?.actionType as string; - - const SYSTEM_INTEGRATION_MAP: Record = { - "Database Query": "database", - }; - - let integrationType: string | undefined; - let requiresCredentials = true; - - if (actionType) { - if (SYSTEM_INTEGRATION_MAP[actionType]) { - integrationType = SYSTEM_INTEGRATION_MAP[actionType]; - } else { - const action = findActionById(actionType); - if (action) { - integrationType = action.integration; - const plugin = getIntegration(action.integration); - requiresCredentials = - plugin?.requiresCredentials !== false; - } - } - } - - if (integrationType && requiresCredentials) { - return ( - - handleUpdateConfig("integrationId", id) - } - value={ - (selectedNode.data.config - ?.integrationId as string) || "" - } - /> - ); - } - if (integrationType && !requiresCredentials) { - return ( -
- - No integration required - -
- ); - } - return null; - })()}
)} diff --git a/keeperhub/lib/integration-helpers.ts b/keeperhub/lib/integration-helpers.ts new file mode 100644 index 000000000..46bb6131e --- /dev/null +++ b/keeperhub/lib/integration-helpers.ts @@ -0,0 +1,22 @@ +/** + * KeeperHub integration helpers + * These helpers extend upstream functionality for KeeperHub-specific features + */ + +import type { IntegrationType } from "@/lib/types/integration"; +import { getIntegration } from "@/plugins"; + +/** + * Check if an integration type requires credentials + * Some integrations (like web3) don't require user credentials + */ +export function integrationRequiresCredentials( + integrationType: IntegrationType | string | undefined +): boolean { + if (!integrationType) { + return false; + } + + const plugin = getIntegration(integrationType as IntegrationType); + return plugin?.requiresCredentials !== false; +} diff --git a/keeperhub/plugins/discord/index.ts b/keeperhub/plugins/discord/index.ts index fbb380062..2b0b31155 100644 --- a/keeperhub/plugins/discord/index.ts +++ b/keeperhub/plugins/discord/index.ts @@ -10,11 +10,12 @@ const discordPlugin: IntegrationPlugin = { icon: DiscordIcon, // Webhook URL is stored in the integration for centralized management + // start keeperhub - type is 'password' so it shows "Configured" state when editing (upstream: 'url') formFields: [ { id: "webhookUrl", label: "Webhook URL", - type: "url", + type: "password", placeholder: "https://discord.com/api/webhooks/...", configKey: "webhookUrl", envVar: "webhookUrl", @@ -26,6 +27,7 @@ const discordPlugin: IntegrationPlugin = { }, }, ], + // end keeperhub actions: [ {