@workos-inc/widgets 1.18.0-next.1788904392369 → 1.18.0

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/pipes-admin.tsx"],"sourcesContent":["\"use client\";\nimport { Callout, Card, Flex, Switch, Text, Tooltip } from \"@radix-ui/themes\";\nimport { useState } from \"react\";\nimport { InfoCircledIcon } from \"@radix-ui/react-icons\";\nimport * as CardList from \"./card-list.js\";\nimport { CopyText } from \"./copy-text.js\";\nimport { DataIntegrationIcon } from \"./data-integration-icon.js\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport {\n Button,\n Dialog,\n Label,\n PasswordField,\n Skeleton,\n TextField,\n} from \"./elements.js\";\nimport { IconPanel } from \"./icon-panel.js\";\nimport { SearchableSelectList } from \"./searchable-select-list.js\";\nimport { Status } from \"./status.js\";\nimport {\n DataIntegrationConfiguration,\n getListDataIntegrationConfigurationsQueryKey,\n getMyDataIntegrationsQueryKey,\n useListDataIntegrationConfigurations,\n useUpsertDataIntegrationConfiguration,\n} from \"../api/endpoint.js\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { GenericError } from \"./generic-error.js\";\nimport { usePermissions } from \"./use-permissions.js\";\nimport { getDomProps, WidgetRootDomProps, WidgetRootState } from \"./utils.js\";\nimport { Translation } from \"./i18n/translation.js\";\nimport { useTranslation } from \"./i18n/use-translation.js\";\nimport { buildRedactedSecret, isRedactedSecret } from \"./redacted-secret.js\";\n\nfunction RedirectUriField({ value }: { value: string }) {\n const translate = useTranslation();\n\n const copyLabel = translate({\n defaultMessage: \"Copy redirect URI\",\n id: \"xqfxBC\",\n description: \"Accessible label for the copy redirect URI button\",\n });\n\n return (\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"Redirect URI\"\n id=\"lgEaUA\"\n description=\"Label for the read-only OAuth redirect URI field\"\n />\n </Label>\n <CopyText value={value} label={copyLabel} />\n </Flex>\n );\n}\n\nfunction OrgCredentialsDialog({\n integration,\n open,\n onOpenChange,\n}: {\n integration: DataIntegrationConfiguration;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}) {\n const queryClient = useQueryClient();\n const credentials = integration.credentials;\n const hasCredentials = credentials.hasCredentials;\n const isOrgCredentials = credentials.credentialsType === \"organization\";\n\n // Seeded once on mount; the dialog is only mounted while open (see\n // OrgCredentialsButton), so each open starts from the current configuration.\n // `enabled`/`scopes` on the configuration are the effective values\n // (the org override when present, else the developer default).\n const redactedSecret = buildRedactedSecret(credentials.redactedClientSecret);\n const [clientId, setClientId] = useState(credentials.client_id ?? \"\");\n const [clientSecret, setClientSecret] = useState(redactedSecret);\n const [enabled, setEnabled] = useState(integration.enabled);\n const [scopes, setScopes] = useState<string[]>(integration.scopes ?? []);\n // Organization credentials are entered first, then scopes (two-step wizard);\n // shared/custom providers only narrow scopes, so they get a single view.\n const [step, setStep] = useState<\"credentials\" | \"scopes\">(\"credentials\");\n const [clientIdError, setClientIdError] = useState<string | null>(null);\n const [clientSecretError, setClientSecretError] = useState<string | null>(\n null,\n );\n\n // Provider-declared `integration`-scope config fields are configured here, but\n // only for `organization` credentials: the API rejects per-org config for\n // shared/custom creds (those are set on the root integration instead). The\n // `installation`-scope pins are deferred from this UI for now (they're\n // collected in the connect modal instead). `secret` fields are excluded: they\n // are rejected server-side, and seeding a masked secret can't be round-tripped\n // safely under the config-replace write.\n const configFields = isOrgCredentials\n ? (integration.configFields ?? [])\n .filter((field) => field.scope === \"integration\" && !field.secret)\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n : [];\n const [configValues, setConfigValues] = useState<Record<string, string>>(\n () => {\n const seed: Record<string, string> = {};\n for (const field of integration.configFields ?? []) {\n if (field.scope !== \"integration\") continue;\n // Never seed a `secret` field from the response: the value may be\n // redacted, and re-submitting the mask would clobber the stored secret.\n if (field.secret) continue;\n const value = integration.config?.[field.key];\n if (typeof value === \"string\") {\n seed[field.key] = value;\n }\n }\n return seed;\n },\n );\n const [configErrors, setConfigErrors] = useState<\n Record<string, string | null>\n >({});\n\n const {\n mutate: upsertOverride,\n error,\n isPending,\n } = useUpsertDataIntegrationConfiguration({\n mutation: {\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: getListDataIntegrationConfigurationsQueryKey(),\n });\n // Saving a configuration can change which providers/scopes are available\n // in the user connection list, so refresh that list too.\n queryClient.invalidateQueries({\n queryKey: getMyDataIntegrationsQueryKey(),\n });\n onOpenChange(false);\n },\n },\n });\n\n const translate = useTranslation();\n\n // Selectable scope pool: organization credentials can request the provider's\n // full catalog; shared/custom can only (re)select within the developer's\n // configured defaults. The current effective selection is always included so\n // it stays toggleable, and the defaults are included so a previously removed\n // default can be re-added.\n const defaultScopes = integration.defaultScopes;\n const effectiveScopes = integration.scopes ?? [];\n const scopePool = isOrgCredentials\n ? [\n ...new Set([\n ...effectiveScopes,\n ...defaultScopes,\n ...integration.availableScopes,\n ]),\n ]\n : [...new Set([...effectiveScopes, ...defaultScopes])];\n // Developer-configured scopes the admin has unselected — named in the warning.\n const removedDefaultScopes = defaultScopes.filter(\n (scope) => !scopes.includes(scope),\n );\n\n const enabledLabel = translate({\n defaultMessage: \"Enable\",\n id: \"hkhtrS\",\n description: \"Label for the enable toggle\",\n });\n const enableTooltip = translate({\n defaultMessage:\n \"Allow this integration to be connected in your organization.\",\n id: \"7ItyG3\",\n description: \"Tooltip explaining the enable toggle\",\n });\n\n const clientIdPlaceholder = translate({\n defaultMessage: \"Enter your {providerName} Client ID\",\n id: \"pAUj4e\",\n description: \"Placeholder for the OAuth client ID input\",\n values: { providerName: integration.name },\n });\n const clientSecretPlaceholder = translate({\n defaultMessage: \"Enter your {providerName} Client Secret\",\n id: \"WoFO8+\",\n description: \"Placeholder for the OAuth client secret input\",\n values: { providerName: integration.name },\n });\n const scopeSearchPlaceholder = translate({\n defaultMessage: \"Search scopes\",\n id: \"fjuuw1\",\n description: \"Placeholder for the scope override search input\",\n });\n const scopeEmptyLabel = translate({\n defaultMessage: \"No scopes found\",\n id: \"OSyQvz\",\n description: \"Empty state for the scope override search\",\n });\n const configRequiredMessage = translate({\n defaultMessage: \"This field is required\",\n id: \"B2HvfC\",\n description:\n \"Validation error shown when a required configuration field is left empty\",\n });\n const configPatternMessage = translate({\n defaultMessage: \"Enter a valid value.\",\n id: \"2XWaGz\",\n description:\n \"Validation error shown when a configuration field value does not match the expected format\",\n });\n const secretRequiredMessage = translate({\n defaultMessage: \"Enter a new Client Secret to change the Client ID.\",\n id: \"O+5rxK\",\n description:\n \"Validation error when changing client id without a new secret\",\n });\n\n // Validate the integration-scope config fields against their descriptors.\n const validateConfigFields = (): boolean => {\n const nextErrors: Record<string, string | null> = {};\n let valid = true;\n for (const field of configFields) {\n const value = (configValues[field.key] ?? \"\").trim();\n if (field.required && !value) {\n nextErrors[field.key] = configRequiredMessage;\n valid = false;\n continue;\n }\n if (value && field.pattern) {\n let matches = true;\n try {\n matches = new RegExp(field.pattern).test(value);\n } catch {\n // Ignore invalid descriptor patterns client-side; the API validates.\n matches = true;\n }\n if (!matches) {\n nextErrors[field.key] = configPatternMessage;\n valid = false;\n continue;\n }\n }\n nextErrors[field.key] = null;\n }\n setConfigErrors(nextErrors);\n return valid;\n };\n\n // Secret descriptor keys are never round-tripped: if the API ever returned a\n // secret as a redacted mask, copying it into the replacement payload would\n // overwrite the stored value. (Secret config fields are rejected server-side\n // today, so this is defensive.)\n const secretConfigKeys = new Set(\n (integration.configFields ?? [])\n .filter((field) => field.secret)\n .map((field) => field.key),\n );\n\n const buildConfigPayload = () => {\n // Preserve existing config keys this UI doesn't render (e.g. installation\n // pins, deferred for now) so saving org settings never drops them.\n const config: Record<string, string> = {};\n for (const [key, value] of Object.entries(integration.config ?? {})) {\n if (typeof value === \"string\" && !secretConfigKeys.has(key)) {\n config[key] = value;\n }\n }\n // Overlay the edited integration-scope fields; an emptied field clears it.\n for (const field of configFields) {\n const value = (configValues[field.key] ?? \"\").trim();\n if (value) {\n config[field.key] = value;\n } else {\n delete config[field.key];\n }\n }\n return config;\n };\n\n // Validate organization credentials before advancing to the scopes step. The\n // secret field is pre-filled with a redacted placeholder for an existing\n // secret; if untouched, keep the stored secret. Since client_id and\n // client_secret travel together, changing the id requires a new secret.\n const validateCredentials = (): boolean => {\n setClientIdError(null);\n setClientSecretError(null);\n const trimmedId = clientId.trim();\n const secretUnchanged = hasCredentials && isRedactedSecret(clientSecret);\n let valid = true;\n if (!trimmedId) {\n setClientIdError(configRequiredMessage);\n valid = false;\n }\n if (secretUnchanged) {\n // Existing secret kept: only re-entry is required when the id changes.\n if (trimmedId && trimmedId !== (credentials.client_id ?? \"\")) {\n setClientSecretError(secretRequiredMessage);\n valid = false;\n }\n } else if (!clientSecret.trim()) {\n setClientSecretError(configRequiredMessage);\n valid = false;\n }\n return valid;\n };\n\n // API-key integrations have no OAuth credentials or scopes to configure;\n // the only override is the enabled toggle.\n const isApiKeyOnly = !(integration.authMethods ?? [\"oauth\"]).includes(\n \"oauth\",\n );\n\n const handleSubmit = () => {\n // Org-cred config fields were validated on the way to the scopes step; the\n // other surfaces submit directly from this view, so validate here.\n if (!isOrgCredentials && !validateConfigFields()) {\n return;\n }\n const configPayload =\n configFields.length > 0 ? { config: buildConfigPayload() } : undefined;\n\n if (isApiKeyOnly) {\n upsertOverride({\n slug: integration.slug,\n data: { enabled, ...configPayload },\n });\n return;\n }\n if (!isOrgCredentials) {\n // shared/custom: enable + (possibly narrowed) scopes only.\n upsertOverride({\n slug: integration.slug,\n data: { enabled, scopes, ...configPayload },\n });\n return;\n }\n // Credentials were validated on the way to the scopes step.\n const secretUnchanged = hasCredentials && isRedactedSecret(clientSecret);\n if (secretUnchanged) {\n upsertOverride({\n slug: integration.slug,\n data: { enabled, scopes, ...configPayload },\n });\n return;\n }\n upsertOverride({\n slug: integration.slug,\n data: {\n enabled,\n client_id: clientId.trim(),\n client_secret: clientSecret.trim(),\n scopes,\n ...configPayload,\n },\n });\n };\n\n const showCredentialsStep =\n !isApiKeyOnly && isOrgCredentials && step === \"credentials\";\n const showScopesStep =\n !isApiKeyOnly && (!isOrgCredentials || step === \"scopes\");\n\n // Disable Save when nothing differs from the seeded override state. Same\n // length + one-way subset means equal scope sets. Credential fields only\n // exist for organization credentials; a \"changed\" secret is a freshly typed\n // value (not the redacted placeholder), so focusing the field doesn't count.\n const initialScopes = integration.scopes ?? [];\n const scopesChanged =\n scopes.length !== initialScopes.length ||\n scopes.some((scope) => !initialScopes.includes(scope));\n const enabledChanged = enabled !== integration.enabled;\n const credentialsChanged =\n isOrgCredentials &&\n (clientId.trim() !== (credentials.client_id ?? \"\") ||\n (clientSecret.trim() !== \"\" && !isRedactedSecret(clientSecret)));\n const configChanged = configFields.some((field) => {\n const current = (configValues[field.key] ?? \"\").trim();\n // Trim both sides so an existing value with incidental surrounding\n // whitespace doesn't read as a pending change on open.\n const original =\n typeof integration.config?.[field.key] === \"string\"\n ? (integration.config[field.key] as string).trim()\n : \"\";\n return current !== original;\n });\n const hasPendingChanges =\n enabledChanged || scopesChanged || credentialsChanged || configChanged;\n\n // Gate the primary button on required fields being populated (matches the\n // ApiKeyDialog / change-email patterns). A redacted secret placeholder counts\n // as populated, so editing an existing config isn't blocked.\n const requiredConfigMissing = configFields.some(\n (field) => field.required && !(configValues[field.key] ?? \"\").trim(),\n );\n const credentialsMissing =\n isOrgCredentials && (!clientId.trim() || !clientSecret.trim());\n const nextDisabled = credentialsMissing || requiredConfigMissing;\n\n const enableToggle = (\n <Flex align=\"center\" gap=\"2\">\n <Switch\n checked={enabled}\n onCheckedChange={setEnabled}\n aria-label={enabledLabel}\n />\n <Text size=\"2\" weight=\"bold\">\n <Translation\n defaultMessage=\"Enable\"\n id=\"hkhtrS\"\n description=\"Label for the enable toggle\"\n />\n </Text>\n <Tooltip content={enableTooltip}>\n <InfoCircledIcon aria-hidden style={{ color: \"var(--gray-9)\" }} />\n </Tooltip>\n </Flex>\n );\n\n const configFieldsSection =\n configFields.length > 0\n ? configFields.map((field) => {\n const fieldId = `pipes-admin-config-${field.key}`;\n const errorId = `${fieldId}-error`;\n const descriptionId = `${fieldId}-description`;\n const error = configErrors[field.key];\n const Control = field.secret ? PasswordField : TextField;\n const describedBy =\n [field.description ? descriptionId : null, error ? errorId : null]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <Flex key={field.key} direction=\"column\" gap=\"1\">\n <Label htmlFor={fieldId}>{field.label}</Label>\n {field.description ? (\n <Text color=\"gray\" size=\"2\" id={descriptionId} mb=\"1\">\n {field.description}\n </Text>\n ) : null}\n <Control\n id={fieldId}\n value={configValues[field.key] ?? \"\"}\n placeholder={field.example}\n autoComplete=\"off\"\n required={field.required || undefined}\n aria-invalid={!!error || undefined}\n aria-describedby={describedBy}\n onChange={(event) => {\n setConfigValues((prev) => ({\n ...prev,\n [field.key]: event.target.value,\n }));\n if (error) {\n setConfigErrors((prev) => ({\n ...prev,\n [field.key]: null,\n }));\n }\n }}\n />\n {error ? (\n <Text color=\"red\" size=\"2\" id={errorId}>\n {error}\n </Text>\n ) : null}\n </Flex>\n );\n })\n : null;\n\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Content>\n <Dialog.Title size=\"3\" weight=\"bold\">\n <Translation\n defaultMessage=\"Configure {integrationName} for your organization\"\n id=\"ep4eY4\"\n description=\"Title of the organization credentials dialog\"\n values={{ integrationName: integration.name }}\n />\n </Dialog.Title>\n {integration.description && (\n <Text size=\"2\" color=\"gray\" mb=\"4\" as=\"p\">\n {integration.description}\n </Text>\n )}\n\n {error && (\n <Callout.Root my=\"3\" color=\"red\" role=\"alert\">\n <Callout.Text>\n <Translation\n defaultMessage=\"We couldn't save these settings. Please check the values and try again.\"\n id=\"zr1ZFZ\"\n description=\"Error message when saving organization settings fails\"\n />\n </Callout.Text>\n </Callout.Root>\n )}\n\n <Flex direction=\"column\" gap=\"4\" mt=\"2\">\n {isApiKeyOnly && (\n <>\n {enableToggle}\n {configFieldsSection}\n </>\n )}\n\n {showCredentialsStep && (\n <>\n {enableToggle}\n\n <RedirectUriField value={credentials.redirectUri} />\n\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"{providerName} Client ID\"\n id=\"Ew2Xew\"\n description=\"Label for the OAuth client ID input\"\n values={{ providerName: integration.name }}\n />\n </Label>\n <TextField\n value={clientId}\n autoComplete=\"off\"\n placeholder={clientIdPlaceholder}\n aria-invalid={!!clientIdError || undefined}\n aria-describedby={\n clientIdError ? \"pipes-admin-client-id-error\" : undefined\n }\n onChange={(event) => {\n setClientId(event.target.value);\n setClientIdError(null);\n }}\n />\n {clientIdError ? (\n <Text color=\"red\" size=\"2\" id=\"pipes-admin-client-id-error\">\n {clientIdError}\n </Text>\n ) : null}\n </Flex>\n\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"{providerName} Client Secret\"\n id=\"hZK/jR\"\n description=\"Label for the OAuth client secret input\"\n values={{ providerName: integration.name }}\n />\n </Label>\n <PasswordField\n value={clientSecret}\n autoComplete=\"off\"\n // The mask is what's shown, so render it as text: a password\n // input would re-bullet its last four digits away.\n type={isRedactedSecret(clientSecret) ? \"text\" : undefined}\n placeholder={clientSecretPlaceholder}\n aria-invalid={!!clientSecretError || undefined}\n aria-describedby={\n clientSecretError\n ? \"pipes-admin-client-secret-error\"\n : undefined\n }\n onChange={(event) => {\n setClientSecret(event.target.value);\n setClientSecretError(null);\n }}\n onFocus={() => {\n if (isRedactedSecret(clientSecret)) {\n setClientSecret(\"\");\n }\n }}\n onBlur={() => {\n if (clientSecret === \"\") {\n setClientSecret(redactedSecret);\n }\n }}\n />\n {clientSecretError ? (\n <Text\n color=\"red\"\n size=\"2\"\n id=\"pipes-admin-client-secret-error\"\n >\n {clientSecretError}\n </Text>\n ) : null}\n </Flex>\n\n {configFieldsSection}\n </>\n )}\n\n {showScopesStep && (\n <>\n {!isOrgCredentials && enableToggle}\n\n {!isOrgCredentials && configFieldsSection}\n\n {scopePool.length > 0 && (\n <Flex direction=\"column\" gap=\"2\">\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"Allowed scopes\"\n id=\"kNy90T\"\n description=\"Label for the scope override picker\"\n />\n </Label>\n <Text size=\"1\" color=\"gray\">\n <Translation\n defaultMessage=\"Selected scopes may be requested by your app. Users still authorize access during their own OAuth flow.\"\n id=\"E2nzZd\"\n description=\"Helper text for the scope override picker\"\n />\n </Text>\n </Flex>\n <SearchableSelectList\n options={scopePool}\n selected={scopes}\n getKey={(scope) => scope}\n getLabel={(scope) => scope}\n onChange={setScopes}\n searchPlaceholder={scopeSearchPlaceholder}\n emptyLabel={scopeEmptyLabel}\n />\n {removedDefaultScopes.length > 0 && (\n <Callout.Root color=\"amber\" role=\"status\">\n <Callout.Icon>\n <InfoCircledIcon />\n </Callout.Icon>\n <Callout.Text>\n <Translation\n defaultMessage=\"You removed developer-configured scopes: {scopes}. This may break this integration.\"\n id=\"1nCuju\"\n description=\"Warning naming the developer-configured scopes the admin removed\"\n values={{ scopes: removedDefaultScopes.join(\", \") }}\n />\n </Callout.Text>\n </Callout.Root>\n )}\n </Flex>\n )}\n </>\n )}\n </Flex>\n\n <Flex justify=\"end\" gap=\"3\" mt=\"5\">\n <Dialog.Close>\n <Button variant=\"secondary\">\n <Translation\n defaultMessage=\"Cancel\"\n id=\"hHNj31\"\n description=\"Cancel button text\"\n />\n </Button>\n </Dialog.Close>\n {showCredentialsStep ? (\n <Button\n type=\"button\"\n disabled={nextDisabled}\n onClick={() => {\n // Run both so each surfaces its own errors before advancing.\n const credentialsValid = validateCredentials();\n const configValid = validateConfigFields();\n if (credentialsValid && configValid) {\n setStep(\"scopes\");\n }\n }}\n >\n <Translation\n defaultMessage=\"Next\"\n id=\"VlKGPx\"\n description=\"Button to advance to the scopes step\"\n />\n </Button>\n ) : (\n <>\n {isOrgCredentials && !isApiKeyOnly && (\n <Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => setStep(\"credentials\")}\n >\n <Translation\n defaultMessage=\"Back\"\n id=\"bnFIEs\"\n description=\"Button to return to the credentials step\"\n />\n </Button>\n )}\n <Button\n type=\"button\"\n disabled={\n isPending || !hasPendingChanges || requiredConfigMissing\n }\n loading={isPending}\n onClick={handleSubmit}\n >\n <Translation\n defaultMessage=\"Save\"\n id=\"MVKPfz\"\n description=\"Button to save organization settings\"\n />\n </Button>\n </>\n )}\n </Flex>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n\nfunction OrgCredentialsButton({\n integration,\n}: {\n integration: DataIntegrationConfiguration;\n}) {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n {open && (\n <OrgCredentialsDialog\n integration={integration}\n open={open}\n onOpenChange={setOpen}\n />\n )}\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n <Translation\n defaultMessage=\"Configure\"\n id=\"ADidi3\"\n description=\"Button to configure organization credentials\"\n />\n </Button>\n </>\n );\n}\n\n/**\n * Integrations the current viewer can manage at the organization level. Backed\n * by React Query, so calling it from multiple components doesn't trigger extra\n * fetches. Surfaces errors so the caller can render an error state rather than\n * a misleadingly empty list: a denied permission (`usePermissions` throws\n * `IncorrectPermissionsError`) and a failed `/configurations` fetch both flow\n * through `error`.\n */\nfunction useManageableIntegrations(): {\n data: DataIntegrationConfiguration[];\n isLoading: boolean;\n isError: boolean;\n error: unknown;\n} {\n const permission = usePermissions(\"widgets:pipes:manage\");\n const configurations = useListDataIntegrationConfigurations({\n query: { enabled: permission.isSuccess },\n });\n\n if (permission.isError) {\n return {\n data: [],\n isLoading: false,\n isError: true,\n error: permission.error,\n };\n }\n if (configurations.isError) {\n return {\n data: [],\n isLoading: false,\n isError: true,\n error: configurations.error,\n };\n }\n\n if (!permission.isSuccess || !configurations.isSuccess) {\n return {\n data: [],\n isLoading: permission.isLoading || configurations.isLoading,\n isError: false,\n error: null,\n };\n }\n\n // All manageable providers (not just organization-credential ones): the\n // tabbed \"Organization settings\" list covers every available provider.\n return {\n data: configurations.data.data,\n isLoading: false,\n isError: false,\n error: null,\n };\n}\n\n/**\n * Returns whether an integration is currently available to members of the\n * organization. All credential types require the effective `enabled` state to\n * be on; organization credentials additionally require a stored credential\n * pair.\n */\nfunction isIntegrationAvailable(\n integration: DataIntegrationConfiguration,\n): boolean {\n // API-key integrations have no org-level OAuth credentials; availability is\n // governed solely by the enabled toggle.\n if (!(integration.authMethods ?? [\"oauth\"]).includes(\"oauth\")) {\n return integration.enabled;\n }\n const credentials = integration.credentials;\n // `enabled` is the effective state (org override when present, else the\n // developer default). Organization credentials additionally require a stored\n // credential pair before the provider can be connected.\n if (credentials.credentialsType === \"organization\") {\n return credentials.hasCredentials && integration.enabled;\n }\n return integration.enabled;\n}\n\nfunction getWidgetRootDomProps(\n state: WidgetRootState,\n domProps: WidgetRootDomProps,\n) {\n return getDomProps({\n ...domProps,\n isWidgetRoot: true,\n widgetId: \"pipes-admin\",\n widgetState: state,\n });\n}\n\ninterface PipesAdminProps extends WidgetRootDomProps {\n integrations: DataIntegrationConfiguration[];\n}\n\n/**\n * IT-admin organization configuration list: every manageable provider with its\n * availability status and a Configure action (credentials + scope overrides).\n * Presentational — the client wrapper fetches via `useManageableIntegrations`.\n */\nconst PipesAdmin: React.FC<PipesAdminProps> = ({\n integrations,\n ...domProps\n}) => {\n return (\n <CardList.Root {...getWidgetRootDomProps(\"resolved\", domProps)}>\n {integrations.map((integration) => {\n const available = isIntegrationAvailable(integration);\n\n return (\n <CardList.Item key={integration.id}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <IconPanel color=\"panel\">\n <DataIntegrationIcon integration={integration} size=\"2\" />\n </IconPanel>\n <Text size=\"2\" weight=\"bold\">\n {integration.name}\n </Text>\n </Flex>\n <Flex align=\"center\" gap=\"4\">\n <Status state={available ? \"success\" : \"neutral\"}>\n {available ? (\n <Translation\n defaultMessage=\"Available\"\n id=\"SytbAY\"\n description=\"Status when an org connection is available to members\"\n />\n ) : (\n <Translation\n defaultMessage=\"Disabled\"\n id=\"O4SGtP\"\n description=\"Status when an org connection is disabled\"\n />\n )}\n </Status>\n <OrgCredentialsButton integration={integration} />\n </Flex>\n </Flex>\n </CardList.Item>\n );\n })}\n </CardList.Root>\n );\n};\n\ninterface PipesAdminLoadingProps extends WidgetRootDomProps {\n count: number;\n}\n\nconst PipesAdminLoading: React.FC<PipesAdminLoadingProps> = ({\n count,\n ...domProps\n}) => {\n return (\n <CardList.Root {...getWidgetRootDomProps(\"loading\", domProps)}>\n {Array.from({ length: count }).map((_, index) => (\n <CardList.Item key={index}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Skeleton>\n <IconPanel>\n <ProviderIcon provider=\"google\" size=\"2\" />\n </IconPanel>\n </Skeleton>\n <Skeleton>\n <Text size=\"2\" weight=\"bold\">\n <Translation\n defaultMessage=\"Google Drive\"\n id=\"g11OOu\"\n description=\"Placeholder text for loading state\"\n />\n </Text>\n </Skeleton>\n </Flex>\n <Skeleton>\n <Button variant=\"secondary\" disabled>\n <Translation\n defaultMessage=\"Configure\"\n id=\"ADidi3\"\n description=\"Button to configure organization credentials\"\n />\n </Button>\n </Skeleton>\n </Flex>\n </CardList.Item>\n ))}\n </CardList.Root>\n );\n};\n\ninterface PipesAdminErrorProps extends WidgetRootDomProps {\n error: unknown;\n}\n\nconst PipesAdminError: React.FC<PipesAdminErrorProps> = ({\n error,\n ...domProps\n}) => {\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"error\", domProps)}>\n <GenericError error={error} />\n </Card>\n );\n};\n\nexport type { PipesAdminProps, PipesAdminLoadingProps, PipesAdminErrorProps };\nexport {\n PipesAdmin,\n PipesAdminLoading,\n PipesAdminError,\n useManageableIntegrations,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CI;AA3C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KA3BkB,KA4BpB,CACD,GACH;AAEJ;AAMA,MAAM,kBAAkD,CAAC;AAAA,EACvD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,4CAAC,sBAAK,MAAK,KAAK,GAAG,sBAAsB,SAAS,QAAQ,GACxD,sDAAC,qCAAa,OAAc,GAC9B;AAEJ;","names":["error"]}
1
+ {"version":3,"sources":["../../../src/lib/pipes-admin.tsx"],"sourcesContent":["\"use client\";\nimport { Callout, Card, Flex, Switch, Text, Tooltip } from \"@radix-ui/themes\";\nimport * as React from \"react\";\nimport { useEffect, useState } from \"react\";\nimport {\n DotsHorizontalIcon,\n ExternalLinkIcon,\n InfoCircledIcon,\n} from \"@radix-ui/react-icons\";\nimport * as CardList from \"./card-list.js\";\nimport { CopyText } from \"./copy-text.js\";\nimport { DataIntegrationIcon } from \"./data-integration-icon.js\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport {\n AlertDialog,\n Button,\n Dialog,\n DropdownMenu,\n IconButton,\n Label,\n PasswordField,\n Skeleton,\n TextField,\n} from \"./elements.js\";\nimport { IconPanel } from \"./icon-panel.js\";\nimport { SearchableSelectList } from \"./searchable-select-list.js\";\nimport { Status } from \"./status.js\";\nimport {\n DataInstallation,\n DataIntegrationConfiguration,\n OrganizationDataIntegration,\n getListDataIntegrationConfigurationsQueryKey,\n getMyDataIntegrationsQueryKey,\n getOrganizationDataIntegrationsQueryKey,\n getSharedDataConnectionsQueryKey,\n useDeleteOrganizationDataInstallation,\n useListDataIntegrationConfigurations,\n useOrganizationDataIntegrations,\n useUpsertDataIntegrationConfiguration,\n useUpsertOrganizationDataIntegrationConfiguration,\n} from \"../api/endpoint.js\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { GenericError } from \"./generic-error.js\";\nimport {\n ApiKeyDialog,\n ClientCredentialsDialog,\n ConnectDialog,\n ConnectionOwner,\n PipesEmptyItem,\n PipesSection,\n getUnpinnedInstallationFields,\n} from \"./pipes.js\";\nimport { usePermissions } from \"./use-permissions.js\";\nimport { getDomProps, WidgetRootDomProps, WidgetRootState } from \"./utils.js\";\nimport { Translation } from \"./i18n/translation.js\";\nimport { useTranslation } from \"./i18n/use-translation.js\";\nimport { buildRedactedSecret, isRedactedSecret } from \"./redacted-secret.js\";\n\nfunction RedirectUriField({ value }: { value: string }) {\n const translate = useTranslation();\n\n const copyLabel = translate({\n defaultMessage: \"Copy redirect URI\",\n id: \"xqfxBC\",\n description: \"Accessible label for the copy redirect URI button\",\n });\n\n return (\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"Redirect URI\"\n id=\"lgEaUA\"\n description=\"Label for the read-only OAuth redirect URI field\"\n />\n </Label>\n <CopyText value={value} label={copyLabel} />\n </Flex>\n );\n}\n\n/**\n * The configuration surface the credentials dialog edits. Structurally shared\n * by the user-policy configuration (`/configurations`) and the organization\n * configuration nested in an organization-owned integration (`/organization`).\n */\ntype ConfigurableIntegration = Pick<\n DataIntegrationConfiguration,\n | \"name\"\n | \"description\"\n | \"slug\"\n | \"authMethods\"\n | \"enabled\"\n | \"scopes\"\n | \"defaultScopes\"\n | \"availableScopes\"\n | \"credentials\"\n | \"configFields\"\n | \"config\"\n>;\n\n/**\n * Saves a configuration for its owner. The user-policy write governs what\n * members may connect on their own, so it refreshes the member list; the\n * organization write changes the organization's own connection, so it\n * refreshes the shared lanes instead.\n */\nfunction useUpsertConfiguration(owner: ConnectionOwner, onSuccess: () => void) {\n const queryClient = useQueryClient();\n const user = useUpsertDataIntegrationConfiguration({\n mutation: {\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: getListDataIntegrationConfigurationsQueryKey(),\n });\n // Saving a configuration can change which providers/scopes are available\n // in the user connection list, so refresh that list too.\n queryClient.invalidateQueries({\n queryKey: getMyDataIntegrationsQueryKey(),\n });\n onSuccess();\n },\n },\n });\n const organization = useUpsertOrganizationDataIntegrationConfiguration({\n mutation: {\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: getOrganizationDataIntegrationsQueryKey(),\n });\n queryClient.invalidateQueries({\n queryKey: getSharedDataConnectionsQueryKey(),\n });\n onSuccess();\n },\n },\n });\n\n return owner === \"organization\" ? organization : user;\n}\n\nfunction OrgCredentialsDialog({\n integration,\n open,\n onOpenChange,\n owner = \"user\",\n}: {\n integration: ConfigurableIntegration;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n owner?: ConnectionOwner;\n}) {\n const credentials = integration.credentials;\n const hasCredentials = credentials.hasCredentials;\n const isOrgCredentials = credentials.credentialsType === \"organization\";\n\n // Seeded once on mount; the dialog is only mounted while open (see\n // OrgCredentialsButton), so each open starts from the current configuration.\n // `enabled`/`scopes` on the configuration are the effective values\n // (the org override when present, else the developer default).\n const redactedSecret = buildRedactedSecret(credentials.redactedClientSecret);\n const [clientId, setClientId] = useState(credentials.client_id ?? \"\");\n const [clientSecret, setClientSecret] = useState(redactedSecret);\n const [enabled, setEnabled] = useState(integration.enabled);\n const [scopes, setScopes] = useState<string[]>(integration.scopes ?? []);\n // Organization credentials are entered first, then scopes (two-step wizard);\n // shared/custom providers only narrow scopes, so they get a single view.\n const [step, setStep] = useState<\"credentials\" | \"scopes\">(\"credentials\");\n const [clientIdError, setClientIdError] = useState<string | null>(null);\n const [clientSecretError, setClientSecretError] = useState<string | null>(\n null,\n );\n\n // Provider-declared `integration`-scope config fields are configured here, but\n // only for `organization` credentials: the API rejects per-org config for\n // shared/custom creds (those are set on the root integration instead). The\n // `installation`-scope pins are deferred from this UI for now (they're\n // collected in the connect modal instead). `secret` fields are excluded: they\n // are rejected server-side, and seeding a masked secret can't be round-tripped\n // safely under the config-replace write.\n const configFields = isOrgCredentials\n ? (integration.configFields ?? [])\n .filter((field) => field.scope === \"integration\" && !field.secret)\n .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))\n : [];\n const [configValues, setConfigValues] = useState<Record<string, string>>(\n () => {\n const seed: Record<string, string> = {};\n for (const field of integration.configFields ?? []) {\n if (field.scope !== \"integration\") continue;\n // Never seed a `secret` field from the response: the value may be\n // redacted, and re-submitting the mask would clobber the stored secret.\n if (field.secret) continue;\n const value = integration.config?.[field.key];\n if (typeof value === \"string\") {\n seed[field.key] = value;\n }\n }\n return seed;\n },\n );\n const [configErrors, setConfigErrors] = useState<\n Record<string, string | null>\n >({});\n\n const {\n mutate: upsertOverride,\n error,\n isPending,\n } = useUpsertConfiguration(owner, () => onOpenChange(false));\n\n const translate = useTranslation();\n\n // Selectable scope pool: organization credentials can request the provider's\n // full catalog; shared/custom can only (re)select within the developer's\n // configured defaults. The current effective selection is always included so\n // it stays toggleable, and the defaults are included so a previously removed\n // default can be re-added.\n const defaultScopes = integration.defaultScopes;\n const effectiveScopes = integration.scopes ?? [];\n const scopePool = isOrgCredentials\n ? [\n ...new Set([\n ...effectiveScopes,\n ...defaultScopes,\n ...integration.availableScopes,\n ]),\n ]\n : [...new Set([...effectiveScopes, ...defaultScopes])];\n // Developer-configured scopes the admin has unselected — named in the warning.\n const removedDefaultScopes = defaultScopes.filter(\n (scope) => !scopes.includes(scope),\n );\n\n const enabledLabel = translate({\n defaultMessage: \"Enable\",\n id: \"hkhtrS\",\n description: \"Label for the enable toggle\",\n });\n const enableTooltip = translate({\n defaultMessage:\n \"Allow this integration to be connected in your organization.\",\n id: \"7ItyG3\",\n description: \"Tooltip explaining the enable toggle\",\n });\n\n const clientIdPlaceholder = translate({\n defaultMessage: \"Enter your {providerName} Client ID\",\n id: \"pAUj4e\",\n description: \"Placeholder for the OAuth client ID input\",\n values: { providerName: integration.name },\n });\n const clientSecretPlaceholder = translate({\n defaultMessage: \"Enter your {providerName} Client Secret\",\n id: \"WoFO8+\",\n description: \"Placeholder for the OAuth client secret input\",\n values: { providerName: integration.name },\n });\n const scopeSearchPlaceholder = translate({\n defaultMessage: \"Search scopes\",\n id: \"fjuuw1\",\n description: \"Placeholder for the scope override search input\",\n });\n const scopeEmptyLabel = translate({\n defaultMessage: \"No scopes found\",\n id: \"OSyQvz\",\n description: \"Empty state for the scope override search\",\n });\n const configRequiredMessage = translate({\n defaultMessage: \"This field is required\",\n id: \"B2HvfC\",\n description:\n \"Validation error shown when a required configuration field is left empty\",\n });\n const configPatternMessage = translate({\n defaultMessage: \"Enter a valid value.\",\n id: \"2XWaGz\",\n description:\n \"Validation error shown when a configuration field value does not match the expected format\",\n });\n const secretRequiredMessage = translate({\n defaultMessage: \"Enter a new Client Secret to change the Client ID.\",\n id: \"O+5rxK\",\n description:\n \"Validation error when changing client id without a new secret\",\n });\n\n // Validate the integration-scope config fields against their descriptors.\n const validateConfigFields = (): boolean => {\n const nextErrors: Record<string, string | null> = {};\n let valid = true;\n for (const field of configFields) {\n const value = (configValues[field.key] ?? \"\").trim();\n if (field.required && !value) {\n nextErrors[field.key] = configRequiredMessage;\n valid = false;\n continue;\n }\n if (value && field.pattern) {\n let matches = true;\n try {\n matches = new RegExp(field.pattern).test(value);\n } catch {\n // Ignore invalid descriptor patterns client-side; the API validates.\n matches = true;\n }\n if (!matches) {\n nextErrors[field.key] = configPatternMessage;\n valid = false;\n continue;\n }\n }\n nextErrors[field.key] = null;\n }\n setConfigErrors(nextErrors);\n return valid;\n };\n\n // Secret descriptor keys are never round-tripped: if the API ever returned a\n // secret as a redacted mask, copying it into the replacement payload would\n // overwrite the stored value. (Secret config fields are rejected server-side\n // today, so this is defensive.)\n const secretConfigKeys = new Set(\n (integration.configFields ?? [])\n .filter((field) => field.secret)\n .map((field) => field.key),\n );\n\n const buildConfigPayload = () => {\n // Preserve existing config keys this UI doesn't render (e.g. installation\n // pins, deferred for now) so saving org settings never drops them.\n const config: Record<string, string> = {};\n for (const [key, value] of Object.entries(integration.config ?? {})) {\n if (typeof value === \"string\" && !secretConfigKeys.has(key)) {\n config[key] = value;\n }\n }\n // Overlay the edited integration-scope fields; an emptied field clears it.\n for (const field of configFields) {\n const value = (configValues[field.key] ?? \"\").trim();\n if (value) {\n config[field.key] = value;\n } else {\n delete config[field.key];\n }\n }\n return config;\n };\n\n // Validate organization credentials before advancing to the scopes step. The\n // secret field is pre-filled with a redacted placeholder for an existing\n // secret; if untouched, keep the stored secret. Since client_id and\n // client_secret travel together, changing the id requires a new secret.\n const validateCredentials = (): boolean => {\n setClientIdError(null);\n setClientSecretError(null);\n const trimmedId = clientId.trim();\n const secretUnchanged = hasCredentials && isRedactedSecret(clientSecret);\n let valid = true;\n if (!trimmedId) {\n setClientIdError(configRequiredMessage);\n valid = false;\n }\n if (secretUnchanged) {\n // Existing secret kept: only re-entry is required when the id changes.\n if (trimmedId && trimmedId !== (credentials.client_id ?? \"\")) {\n setClientSecretError(secretRequiredMessage);\n valid = false;\n }\n } else if (!clientSecret.trim()) {\n setClientSecretError(configRequiredMessage);\n valid = false;\n }\n return valid;\n };\n\n // API-key integrations have no OAuth credentials or scopes to configure;\n // the only override is the enabled toggle.\n const isApiKeyOnly = !(integration.authMethods ?? [\"oauth\"]).includes(\n \"oauth\",\n );\n\n const handleSubmit = () => {\n // Org-cred config fields were validated on the way to the scopes step; the\n // other surfaces submit directly from this view, so validate here.\n if (!isOrgCredentials && !validateConfigFields()) {\n return;\n }\n const configPayload =\n configFields.length > 0 ? { config: buildConfigPayload() } : undefined;\n\n if (isApiKeyOnly) {\n upsertOverride({\n slug: integration.slug,\n data: { enabled, ...configPayload },\n });\n return;\n }\n if (!isOrgCredentials) {\n // shared/custom: enable + (possibly narrowed) scopes only.\n upsertOverride({\n slug: integration.slug,\n data: { enabled, scopes, ...configPayload },\n });\n return;\n }\n // Credentials were validated on the way to the scopes step.\n const secretUnchanged = hasCredentials && isRedactedSecret(clientSecret);\n if (secretUnchanged) {\n upsertOverride({\n slug: integration.slug,\n data: { enabled, scopes, ...configPayload },\n });\n return;\n }\n upsertOverride({\n slug: integration.slug,\n data: {\n enabled,\n client_id: clientId.trim(),\n client_secret: clientSecret.trim(),\n scopes,\n ...configPayload,\n },\n });\n };\n\n const showCredentialsStep =\n !isApiKeyOnly && isOrgCredentials && step === \"credentials\";\n const showScopesStep =\n !isApiKeyOnly && (!isOrgCredentials || step === \"scopes\");\n\n // Disable Save when nothing differs from the seeded override state. Same\n // length + one-way subset means equal scope sets. Credential fields only\n // exist for organization credentials; a \"changed\" secret is a freshly typed\n // value (not the redacted placeholder), so focusing the field doesn't count.\n const initialScopes = integration.scopes ?? [];\n const scopesChanged =\n scopes.length !== initialScopes.length ||\n scopes.some((scope) => !initialScopes.includes(scope));\n const enabledChanged = enabled !== integration.enabled;\n const credentialsChanged =\n isOrgCredentials &&\n (clientId.trim() !== (credentials.client_id ?? \"\") ||\n (clientSecret.trim() !== \"\" && !isRedactedSecret(clientSecret)));\n const configChanged = configFields.some((field) => {\n const current = (configValues[field.key] ?? \"\").trim();\n // Trim both sides so an existing value with incidental surrounding\n // whitespace doesn't read as a pending change on open.\n const original =\n typeof integration.config?.[field.key] === \"string\"\n ? (integration.config[field.key] as string).trim()\n : \"\";\n return current !== original;\n });\n const hasPendingChanges =\n enabledChanged || scopesChanged || credentialsChanged || configChanged;\n\n // Gate the primary button on required fields being populated (matches the\n // ApiKeyDialog / change-email patterns). A redacted secret placeholder counts\n // as populated, so editing an existing config isn't blocked.\n const requiredConfigMissing = configFields.some(\n (field) => field.required && !(configValues[field.key] ?? \"\").trim(),\n );\n const credentialsMissing =\n isOrgCredentials && (!clientId.trim() || !clientSecret.trim());\n const nextDisabled = credentialsMissing || requiredConfigMissing;\n\n const enableToggle = (\n <Flex align=\"center\" gap=\"2\">\n <Switch\n checked={enabled}\n onCheckedChange={setEnabled}\n aria-label={enabledLabel}\n />\n <Text size=\"2\" weight=\"bold\">\n <Translation\n defaultMessage=\"Enable\"\n id=\"hkhtrS\"\n description=\"Label for the enable toggle\"\n />\n </Text>\n <Tooltip content={enableTooltip}>\n <InfoCircledIcon aria-hidden style={{ color: \"var(--gray-9)\" }} />\n </Tooltip>\n </Flex>\n );\n\n const configFieldsSection =\n configFields.length > 0\n ? configFields.map((field) => {\n const fieldId = `pipes-admin-config-${field.key}`;\n const errorId = `${fieldId}-error`;\n const descriptionId = `${fieldId}-description`;\n const error = configErrors[field.key];\n const Control = field.secret ? PasswordField : TextField;\n const describedBy =\n [field.description ? descriptionId : null, error ? errorId : null]\n .filter(Boolean)\n .join(\" \") || undefined;\n return (\n <Flex key={field.key} direction=\"column\" gap=\"1\">\n <Label htmlFor={fieldId}>{field.label}</Label>\n {field.description ? (\n <Text color=\"gray\" size=\"2\" id={descriptionId} mb=\"1\">\n {field.description}\n </Text>\n ) : null}\n <Control\n id={fieldId}\n value={configValues[field.key] ?? \"\"}\n placeholder={field.example}\n autoComplete=\"off\"\n required={field.required || undefined}\n aria-invalid={!!error || undefined}\n aria-describedby={describedBy}\n onChange={(event) => {\n setConfigValues((prev) => ({\n ...prev,\n [field.key]: event.target.value,\n }));\n if (error) {\n setConfigErrors((prev) => ({\n ...prev,\n [field.key]: null,\n }));\n }\n }}\n />\n {error ? (\n <Text color=\"red\" size=\"2\" id={errorId}>\n {error}\n </Text>\n ) : null}\n </Flex>\n );\n })\n : null;\n\n return (\n <Dialog.Root open={open} onOpenChange={onOpenChange}>\n <Dialog.Content>\n <Dialog.Title size=\"3\" weight=\"bold\">\n <Translation\n defaultMessage=\"Configure {integrationName} for your organization\"\n id=\"ep4eY4\"\n description=\"Title of the organization credentials dialog\"\n values={{ integrationName: integration.name }}\n />\n </Dialog.Title>\n {integration.description && (\n <Text size=\"2\" color=\"gray\" mb=\"4\" as=\"p\">\n {integration.description}\n </Text>\n )}\n\n {error && (\n <Callout.Root my=\"3\" color=\"red\" role=\"alert\">\n <Callout.Text>\n <Translation\n defaultMessage=\"We couldn't save these settings. Please check the values and try again.\"\n id=\"zr1ZFZ\"\n description=\"Error message when saving organization settings fails\"\n />\n </Callout.Text>\n </Callout.Root>\n )}\n\n <Flex direction=\"column\" gap=\"4\" mt=\"2\">\n {isApiKeyOnly && (\n <>\n {enableToggle}\n {configFieldsSection}\n </>\n )}\n\n {showCredentialsStep && (\n <>\n {enableToggle}\n\n <RedirectUriField value={credentials.redirectUri} />\n\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"{providerName} Client ID\"\n id=\"Ew2Xew\"\n description=\"Label for the OAuth client ID input\"\n values={{ providerName: integration.name }}\n />\n </Label>\n <TextField\n value={clientId}\n autoComplete=\"off\"\n placeholder={clientIdPlaceholder}\n aria-invalid={!!clientIdError || undefined}\n aria-describedby={\n clientIdError ? \"pipes-admin-client-id-error\" : undefined\n }\n onChange={(event) => {\n setClientId(event.target.value);\n setClientIdError(null);\n }}\n />\n {clientIdError ? (\n <Text color=\"red\" size=\"2\" id=\"pipes-admin-client-id-error\">\n {clientIdError}\n </Text>\n ) : null}\n </Flex>\n\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"{providerName} Client Secret\"\n id=\"hZK/jR\"\n description=\"Label for the OAuth client secret input\"\n values={{ providerName: integration.name }}\n />\n </Label>\n <PasswordField\n value={clientSecret}\n autoComplete=\"off\"\n // The mask is what's shown, so render it as text: a password\n // input would re-bullet its last four digits away.\n type={isRedactedSecret(clientSecret) ? \"text\" : undefined}\n placeholder={clientSecretPlaceholder}\n aria-invalid={!!clientSecretError || undefined}\n aria-describedby={\n clientSecretError\n ? \"pipes-admin-client-secret-error\"\n : undefined\n }\n onChange={(event) => {\n setClientSecret(event.target.value);\n setClientSecretError(null);\n }}\n onFocus={() => {\n if (isRedactedSecret(clientSecret)) {\n setClientSecret(\"\");\n }\n }}\n onBlur={() => {\n if (clientSecret === \"\") {\n setClientSecret(redactedSecret);\n }\n }}\n />\n {clientSecretError ? (\n <Text\n color=\"red\"\n size=\"2\"\n id=\"pipes-admin-client-secret-error\"\n >\n {clientSecretError}\n </Text>\n ) : null}\n </Flex>\n\n {configFieldsSection}\n </>\n )}\n\n {showScopesStep && (\n <>\n {!isOrgCredentials && enableToggle}\n\n {!isOrgCredentials && configFieldsSection}\n\n {scopePool.length > 0 && (\n <Flex direction=\"column\" gap=\"2\">\n <Flex direction=\"column\" gap=\"1\">\n <Label>\n <Translation\n defaultMessage=\"Allowed scopes\"\n id=\"kNy90T\"\n description=\"Label for the scope override picker\"\n />\n </Label>\n <Text size=\"1\" color=\"gray\">\n <Translation\n defaultMessage=\"Selected scopes may be requested by your app. Users still authorize access during their own OAuth flow.\"\n id=\"E2nzZd\"\n description=\"Helper text for the scope override picker\"\n />\n </Text>\n </Flex>\n <SearchableSelectList\n options={scopePool}\n selected={scopes}\n getKey={(scope) => scope}\n getLabel={(scope) => scope}\n onChange={setScopes}\n searchPlaceholder={scopeSearchPlaceholder}\n emptyLabel={scopeEmptyLabel}\n />\n {removedDefaultScopes.length > 0 && (\n <Callout.Root color=\"amber\" role=\"status\">\n <Callout.Icon>\n <InfoCircledIcon />\n </Callout.Icon>\n <Callout.Text>\n <Translation\n defaultMessage=\"You removed developer-configured scopes: {scopes}. This may break this integration.\"\n id=\"1nCuju\"\n description=\"Warning naming the developer-configured scopes the admin removed\"\n values={{ scopes: removedDefaultScopes.join(\", \") }}\n />\n </Callout.Text>\n </Callout.Root>\n )}\n </Flex>\n )}\n </>\n )}\n </Flex>\n\n <Flex justify=\"end\" gap=\"3\" mt=\"5\">\n <Dialog.Close>\n <Button variant=\"secondary\">\n <Translation\n defaultMessage=\"Cancel\"\n id=\"hHNj31\"\n description=\"Cancel button text\"\n />\n </Button>\n </Dialog.Close>\n {showCredentialsStep ? (\n <Button\n type=\"button\"\n disabled={nextDisabled}\n onClick={() => {\n // Run both so each surfaces its own errors before advancing.\n const credentialsValid = validateCredentials();\n const configValid = validateConfigFields();\n if (credentialsValid && configValid) {\n setStep(\"scopes\");\n }\n }}\n >\n <Translation\n defaultMessage=\"Next\"\n id=\"VlKGPx\"\n description=\"Button to advance to the scopes step\"\n />\n </Button>\n ) : (\n <>\n {isOrgCredentials && !isApiKeyOnly && (\n <Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => setStep(\"credentials\")}\n >\n <Translation\n defaultMessage=\"Back\"\n id=\"bnFIEs\"\n description=\"Button to return to the credentials step\"\n />\n </Button>\n )}\n <Button\n type=\"button\"\n disabled={\n isPending || !hasPendingChanges || requiredConfigMissing\n }\n loading={isPending}\n onClick={handleSubmit}\n >\n <Translation\n defaultMessage=\"Save\"\n id=\"MVKPfz\"\n description=\"Button to save organization settings\"\n />\n </Button>\n </>\n )}\n </Flex>\n </Dialog.Content>\n </Dialog.Root>\n );\n}\n\nfunction OrgCredentialsButton({\n integration,\n}: {\n integration: DataIntegrationConfiguration;\n}) {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n {open && (\n <OrgCredentialsDialog\n integration={integration}\n open={open}\n onOpenChange={setOpen}\n />\n )}\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n <Translation\n defaultMessage=\"Configure\"\n id=\"ADidi3\"\n description=\"Button to configure organization credentials\"\n />\n </Button>\n </>\n );\n}\n\n/**\n * Integrations the current viewer can manage at the organization level. Backed\n * by React Query, so calling it from multiple components doesn't trigger extra\n * fetches. Surfaces errors so the caller can render an error state rather than\n * a misleadingly empty list: a denied permission (`usePermissions` throws\n * `IncorrectPermissionsError`) and a failed `/configurations` fetch both flow\n * through `error`.\n */\nfunction useManageableIntegrations(): {\n data: DataIntegrationConfiguration[];\n isLoading: boolean;\n isError: boolean;\n error: unknown;\n} {\n const permission = usePermissions(\"widgets:pipes:manage\");\n const configurations = useListDataIntegrationConfigurations({\n query: { enabled: permission.isSuccess },\n });\n\n if (permission.isError) {\n return {\n data: [],\n isLoading: false,\n isError: true,\n error: permission.error,\n };\n }\n if (configurations.isError) {\n return {\n data: [],\n isLoading: false,\n isError: true,\n error: configurations.error,\n };\n }\n\n if (!permission.isSuccess || !configurations.isSuccess) {\n return {\n data: [],\n isLoading: permission.isLoading || configurations.isLoading,\n isError: false,\n error: null,\n };\n }\n\n // All manageable providers (not just organization-credential ones): the\n // tabbed \"Organization settings\" list covers every available provider.\n return {\n data: configurations.data.data,\n isLoading: false,\n isError: false,\n error: null,\n };\n}\n\n/**\n * Integrations the organization owns and shares with everyone, with the\n * organization's configuration and the actions the server allows on them.\n * Gated on the same manage permission as provider settings, but cached\n * separately so the two sections resolve independently. Like the member\n * widget, a failed attempt drops the section rather than leaving skeletons up\n * for the whole retry sequence.\n */\nfunction useOrganizationOwnedIntegrations(): {\n data: OrganizationDataIntegration[];\n isLoading: boolean;\n} {\n const permission = usePermissions(\"widgets:pipes:manage\");\n const organization = useOrganizationDataIntegrations({\n query: { enabled: permission.isSuccess },\n });\n\n if (organization.isSuccess) {\n return { data: organization.data.data, isLoading: false };\n }\n return {\n data: [],\n isLoading:\n permission.isLoading ||\n (permission.isSuccess &&\n organization.isPending &&\n organization.failureCount === 0),\n };\n}\n\n/**\n * The organization-owned integration's configuration, in the shape the\n * credentials dialog edits. Provider metadata sits on the integration; the\n * organization's settings sit under `configuration`.\n */\nfunction toConfigurableIntegration(\n integration: OrganizationDataIntegration,\n): ConfigurableIntegration {\n const { configuration } = integration;\n return {\n name: integration.name,\n description: integration.description,\n slug: integration.slug,\n authMethods: integration.authMethods ?? [\"oauth\"],\n enabled: configuration.enabled,\n scopes: configuration.scopes,\n defaultScopes: configuration.defaultScopes,\n availableScopes: configuration.availableScopes,\n credentials: configuration.credentials,\n configFields: configuration.configFields,\n config: configuration.config,\n };\n}\n\nfunction DisconnectSharedConnectionDialog({\n integrationName,\n installationId,\n open,\n onOpenChange,\n}: {\n integrationName: string;\n installationId: string;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n}) {\n const queryClient = useQueryClient();\n const {\n mutate: deleteInstallation,\n error,\n reset,\n isPending,\n } = useDeleteOrganizationDataInstallation({\n mutation: {\n onSuccess: () => {\n onOpenChange(false);\n queryClient.invalidateQueries({\n queryKey: getOrganizationDataIntegrationsQueryKey(),\n });\n queryClient.invalidateQueries({\n queryKey: getSharedDataConnectionsQueryKey(),\n });\n },\n },\n });\n\n useEffect(() => {\n if (open) {\n reset();\n }\n }, [open, reset]);\n\n return (\n <AlertDialog.Root open={open} onOpenChange={onOpenChange}>\n <AlertDialog.Content style={{ width: \"80vw\", maxWidth: \"520px\" }}>\n <AlertDialog.Title>\n <Translation\n defaultMessage=\"Disconnect shared connection\"\n id=\"Xy5Xq1\"\n description=\"Dialog title for disconnecting an organization-owned connection\"\n />\n </AlertDialog.Title>\n {error && (\n <Callout.Root my=\"5\" color=\"red\" role=\"alert\">\n <Callout.Text>\n <Translation\n defaultMessage=\"An error occurred while disconnecting this connection. Please refresh the page and try again.\"\n id=\"q0Yb2E\"\n description=\"Error message when disconnecting an organization-owned connection fails\"\n />\n </Callout.Text>\n </Callout.Root>\n )}\n <AlertDialog.Description>\n <Translation\n defaultMessage=\"Are you sure you want to disconnect the {integrationName} account your organization shares with everyone? Members will lose access to it.\"\n id=\"mS2v8L\"\n description=\"Confirmation message for disconnecting an organization-owned connection\"\n values={{\n integrationName: (\n <Text as=\"span\" weight=\"bold\">\n {integrationName}\n </Text>\n ),\n }}\n />\n </AlertDialog.Description>\n <Flex gap=\"3\" justify=\"end\" mt=\"5\">\n <AlertDialog.Cancel>\n <Button variant=\"secondary\">\n <Translation\n defaultMessage=\"Cancel\"\n id=\"hHNj31\"\n description=\"Cancel button text\"\n />\n </Button>\n </AlertDialog.Cancel>\n <Button\n variant=\"destructive\"\n disabled={isPending}\n loading={isPending}\n onClick={() => deleteInstallation({ installationId })}\n >\n <Translation\n defaultMessage=\"Disconnect\"\n id=\"vMVXQh\"\n description=\"Button to disconnect an account\"\n />\n </Button>\n </Flex>\n </AlertDialog.Content>\n </AlertDialog.Root>\n );\n}\n\ntype SharedConnectionAuthMethod = DataInstallation[\"auth_method\"];\n\ninterface AdminRowAction {\n key: string;\n label: React.ReactNode;\n onSelect: () => void;\n /** Rendered as the row's single button; everything else goes in the overflow. */\n promoted?: boolean;\n destructive?: boolean;\n external?: boolean;\n}\n\n/**\n * The sectioned admin row grammar: status inline beside the name, the\n * connector description as the only second line, at most one promoted action\n * and the rest behind an overflow menu.\n */\nfunction AdminRow({\n integration,\n status,\n description = integration.description,\n dimmed = false,\n actions,\n}: {\n integration: DataIntegrationConfiguration | OrganizationDataIntegration;\n status?: React.ReactNode;\n description?: React.ReactNode;\n dimmed?: boolean;\n actions: AdminRowAction[];\n}) {\n const translate = useTranslation();\n const actionsTitle = translate({\n defaultMessage: \"More actions\",\n id: \"eR4kYp\",\n description: \"Accessible title for a provider row's overflow actions menu\",\n });\n const promoted = actions.find((action) => action.promoted);\n const overflow = actions.filter((action) => action !== promoted);\n\n return (\n <CardList.Item>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"4\">\n <Flex gap=\"4\" align=\"center\" style={dimmed ? { opacity: 0.6 } : {}}>\n <IconPanel color=\"panel\">\n <DataIntegrationIcon integration={integration} size=\"2\" />\n </IconPanel>\n <Flex direction=\"column\" gap=\"1\">\n <Flex align=\"center\" gap=\"2\" wrap=\"wrap\">\n <Text size=\"2\" weight=\"bold\" color={dimmed ? \"gray\" : undefined}>\n {integration.name}\n </Text>\n {status}\n </Flex>\n {description && (\n <Text size=\"2\" color=\"gray\">\n {description}\n </Text>\n )}\n </Flex>\n </Flex>\n {(promoted || overflow.length > 0) && (\n <Flex align=\"center\" gap=\"2\" flexShrink=\"0\">\n {promoted && (\n <Button\n variant={promoted.destructive ? \"destructive\" : \"secondary\"}\n onClick={promoted.onSelect}\n >\n {promoted.label}\n </Button>\n )}\n {overflow.length > 0 && (\n <DropdownMenu.Root>\n <DropdownMenu.Trigger>\n <IconButton title={actionsTitle}>\n <DotsHorizontalIcon />\n </IconButton>\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"end\">\n {overflow.map((action) => (\n <DropdownMenu.Item\n key={action.key}\n variant={action.destructive ? \"destructive\" : undefined}\n onClick={action.onSelect}\n >\n {action.external ? (\n <Flex\n gap=\"4\"\n width=\"100%\"\n justify=\"between\"\n align=\"center\"\n >\n {action.label}\n <ExternalLinkIcon aria-hidden />\n </Flex>\n ) : (\n action.label\n )}\n </DropdownMenu.Item>\n ))}\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n )}\n </Flex>\n )}\n </Flex>\n </CardList.Item>\n );\n}\n\nfunction ConnectedViaStatus({\n method,\n}: {\n method: SharedConnectionAuthMethod;\n}) {\n return (\n <Status state=\"success\">\n {method === \"api_key\" ? (\n <Translation\n defaultMessage=\"Connected via API key\"\n id=\"jQLTNe\"\n description=\"Status text for a connection established with an API key\"\n />\n ) : method === \"client_credentials\" ? (\n <Translation\n defaultMessage=\"Connected via client credentials\"\n id=\"hQKIrx\"\n description=\"Status text for a connection established with client credentials\"\n />\n ) : (\n <Translation\n defaultMessage=\"Connected via OAuth\"\n id=\"pJcK_M\"\n description=\"Status text for a connection established with OAuth\"\n />\n )}\n </Status>\n );\n}\n\nfunction DisabledForOrganizationStatus() {\n return (\n <Status state=\"neutral\">\n <Translation\n defaultMessage=\"Disabled for your organization\"\n id=\"uH2sNc\"\n description=\"Status for a provider the organization has disabled\"\n />\n </Status>\n );\n}\n\nfunction SharedConnectionAdminStatus({\n integration,\n method,\n}: {\n integration: OrganizationDataIntegration;\n method: SharedConnectionAuthMethod;\n}) {\n const { configuration } = integration;\n const account = integration.connected_accounts[0];\n\n if (!configuration.enabled) {\n return configuration.disabledSource === \"developer\" ? (\n <Status state=\"neutral\">\n <Translation\n defaultMessage=\"Disabled by developer\"\n id=\"k2Jd9W\"\n description=\"Status text for a shared connection the developer has disabled\"\n />\n </Status>\n ) : (\n <DisabledForOrganizationStatus />\n );\n }\n if (!account) {\n return null;\n }\n return account.state === \"connected\" ? (\n <ConnectedViaStatus method={method} />\n ) : (\n <Status state=\"warning\">\n <Translation\n defaultMessage=\"Needs attention\"\n id=\"pL5wGd\"\n description=\"Status for a shared connection that stopped working and needs the admin to fix it\"\n />\n </Status>\n );\n}\n\n/**\n * An organization-owned connection row. Actions are offered strictly per the\n * server's `capabilities`: Configure edits the organization's own credentials\n * and scopes; Connect / Reauthorize run the OAuth flow on the organization's\n * behalf (or open the credential dialog for api_key / client_credentials\n * providers); Disconnect removes the shared account. The fix for a broken\n * connection and the first Connect are promoted; everything else overflows.\n */\nfunction SharedConnectionAdminItem({\n integration,\n}: {\n integration: OrganizationDataIntegration;\n}) {\n const [configureOpen, setConfigureOpen] = useState(false);\n const [connectOpen, setConnectOpen] = useState(false);\n const [disconnectOpen, setDisconnectOpen] = useState(false);\n const { capabilities, configuration } = integration;\n const account = integration.connected_accounts[0];\n // A connected account fixes the method; otherwise prefer OAuth (when the\n // server reports its credentials configured, mirroring how it grants\n // canConnect), then client credentials, then an API key.\n const authMethods = integration.authMethods ?? [];\n const method: SharedConnectionAuthMethod =\n account?.auth_method ??\n (authMethods.includes(\"oauth\") && configuration.configured\n ? \"oauth\"\n : authMethods.includes(\"client_credentials\")\n ? \"client_credentials\"\n : authMethods.includes(\"api_key\")\n ? \"api_key\"\n : \"oauth\");\n const needsAttention = account !== undefined && account.state !== \"connected\";\n\n const showConnect = account\n ? method === \"oauth\"\n ? capabilities.canReauthorize\n : capabilities.canUpdateCredentials\n : capabilities.canConnect;\n const showDisconnect = account !== undefined && capabilities.canDisconnect;\n\n const connectLabel = !account ? (\n <Translation\n defaultMessage=\"Connect\"\n id=\"quvdFp\"\n description=\"Button to connect an integration\"\n />\n ) : method === \"api_key\" ? (\n needsAttention ? (\n <Translation\n defaultMessage=\"Update API key\"\n id=\"E7pMj/\"\n description=\"Menu option to update the API key for a needs-reauthorization installation\"\n />\n ) : (\n <Translation\n defaultMessage=\"Rotate API key\"\n id=\"kR7pQz\"\n description=\"Menu option to rotate an organization-owned API key\"\n />\n )\n ) : method === \"client_credentials\" ? (\n <Translation\n defaultMessage=\"Update client credentials\"\n id=\"vB8dLq\"\n description=\"Menu option to update an organization-owned integration's client credentials\"\n />\n ) : (\n <Translation\n defaultMessage=\"Reauthorize\"\n id=\"0E29F1\"\n description=\"Menu option to reauthorize an integration\"\n trailingSpace\n />\n );\n\n const actions: AdminRowAction[] = [];\n if (showConnect) {\n actions.push({\n key: \"connect\",\n label: connectLabel,\n onSelect: () => setConnectOpen(true),\n promoted: !account || needsAttention,\n external: method === \"oauth\",\n });\n }\n if (capabilities.canConfigure) {\n actions.push({\n key: \"configure\",\n label: (\n <Translation\n defaultMessage=\"Configure\"\n id=\"ADidi3\"\n description=\"Button to configure organization credentials\"\n />\n ),\n onSelect: () => setConfigureOpen(true),\n promoted: !account && !showConnect && configuration.enabled,\n });\n }\n if (showDisconnect) {\n actions.push({\n key: \"disconnect\",\n label: (\n <Translation\n defaultMessage=\"Disconnect\"\n id=\"vMVXQh\"\n description=\"Button to disconnect an account\"\n />\n ),\n onSelect: () => setDisconnectOpen(true),\n destructive: true,\n });\n }\n\n const needsOrganizationCredentials =\n configuration.enabled &&\n !account &&\n configuration.credentials.credentialsType === \"organization\" &&\n !configuration.configured;\n\n return (\n <>\n {configureOpen && (\n <OrgCredentialsDialog\n integration={toConfigurableIntegration(integration)}\n owner=\"organization\"\n open={configureOpen}\n onOpenChange={setConfigureOpen}\n />\n )}\n {method === \"api_key\" ? (\n connectOpen && (\n <ApiKeyDialog\n integration={integration}\n installation={account}\n owner=\"organization\"\n open={connectOpen}\n onOpenChange={setConnectOpen}\n />\n )\n ) : method === \"client_credentials\" ? (\n connectOpen && (\n <ClientCredentialsDialog\n integration={integration}\n installation={account}\n fields={getUnpinnedInstallationFields(integration)}\n owner=\"organization\"\n open={connectOpen}\n onOpenChange={setConnectOpen}\n />\n )\n ) : (\n <ConnectDialog\n integration={integration}\n fields={getUnpinnedInstallationFields(integration)}\n owner=\"organization\"\n open={connectOpen}\n onOpenChange={setConnectOpen}\n />\n )}\n {account && (\n <DisconnectSharedConnectionDialog\n integrationName={integration.name}\n installationId={account.id}\n open={disconnectOpen}\n onOpenChange={setDisconnectOpen}\n />\n )}\n <AdminRow\n integration={integration}\n status={\n <SharedConnectionAdminStatus\n integration={integration}\n method={method}\n />\n }\n description={\n needsOrganizationCredentials ? (\n <Translation\n defaultMessage=\"Enter your organization's OAuth client to make this connectable.\"\n id=\"rQ8mVz\"\n description=\"Second line of a shared connection row whose organization OAuth credentials have not been entered yet\"\n />\n ) : (\n integration.description\n )\n }\n dimmed={!configuration.enabled}\n actions={actions}\n />\n </>\n );\n}\n\n/**\n * A provider settings row in the sectioned view: the policy governing what\n * members may connect on their own. Configure is the only action; the status\n * only speaks up when something keeps members from connecting.\n */\nfunction ProviderSettingsItem({\n integration,\n}: {\n integration: DataIntegrationConfiguration;\n}) {\n const [configureOpen, setConfigureOpen] = useState(false);\n const available = isIntegrationAvailable(integration);\n const dimmed = !integration.enabled;\n\n return (\n <>\n {configureOpen && (\n <OrgCredentialsDialog\n integration={integration}\n open={configureOpen}\n onOpenChange={setConfigureOpen}\n />\n )}\n <AdminRow\n integration={integration}\n status={\n !integration.enabled ? (\n <DisabledForOrganizationStatus />\n ) : !available ? (\n <Status state=\"neutral\">\n <Translation\n defaultMessage=\"Not configured\"\n id=\"gV7bXe\"\n description=\"Status for a provider whose organization credentials have not been entered yet\"\n />\n </Status>\n ) : null\n }\n dimmed={dimmed}\n actions={[\n {\n key: \"configure\",\n label: (\n <Translation\n defaultMessage=\"Configure\"\n id=\"ADidi3\"\n description=\"Button to configure organization credentials\"\n />\n ),\n onSelect: () => setConfigureOpen(true),\n promoted: true,\n },\n ]}\n />\n </>\n );\n}\n\n/**\n * Returns whether an integration is currently available to members of the\n * organization. All credential types require the effective `enabled` state to\n * be on; organization credentials additionally require a stored credential\n * pair.\n */\nfunction isIntegrationAvailable(\n integration: DataIntegrationConfiguration,\n): boolean {\n // API-key integrations have no org-level OAuth credentials; availability is\n // governed solely by the enabled toggle.\n if (!(integration.authMethods ?? [\"oauth\"]).includes(\"oauth\")) {\n return integration.enabled;\n }\n const credentials = integration.credentials;\n // `enabled` is the effective state (org override when present, else the\n // developer default). Organization credentials additionally require a stored\n // credential pair before the provider can be connected.\n if (credentials.credentialsType === \"organization\") {\n return credentials.hasCredentials && integration.enabled;\n }\n return integration.enabled;\n}\n\nfunction getWidgetRootDomProps(\n state: WidgetRootState,\n domProps: WidgetRootDomProps,\n) {\n return getDomProps({\n ...domProps,\n isWidgetRoot: true,\n widgetId: \"pipes-admin\",\n widgetState: state,\n });\n}\n\ninterface PipesAdminProps extends WidgetRootDomProps {\n integrations: DataIntegrationConfiguration[];\n}\n\n/**\n * IT-admin organization configuration list: every manageable provider with its\n * availability status and a Configure action (credentials + scope overrides).\n * Presentational — the client wrapper fetches via `useManageableIntegrations`.\n */\nconst PipesAdmin: React.FC<PipesAdminProps> = ({\n integrations,\n ...domProps\n}) => {\n return (\n <CardList.Root {...getWidgetRootDomProps(\"resolved\", domProps)}>\n <PipesAdminItems integrations={integrations} />\n </CardList.Root>\n );\n};\n\n/** Provider settings rows: availability status and a Configure action each. */\nfunction PipesAdminItems({\n integrations,\n}: {\n integrations: DataIntegrationConfiguration[];\n}) {\n return (\n <>\n {integrations.map((integration) => {\n const available = isIntegrationAvailable(integration);\n\n return (\n <CardList.Item key={integration.id}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <IconPanel color=\"panel\">\n <DataIntegrationIcon integration={integration} size=\"2\" />\n </IconPanel>\n <Text size=\"2\" weight=\"bold\">\n {integration.name}\n </Text>\n </Flex>\n <Flex align=\"center\" gap=\"4\">\n <Status state={available ? \"success\" : \"neutral\"}>\n {available ? (\n <Translation\n defaultMessage=\"Available\"\n id=\"SytbAY\"\n description=\"Status when an org connection is available to members\"\n />\n ) : (\n <Translation\n defaultMessage=\"Disabled\"\n id=\"O4SGtP\"\n description=\"Status when an org connection is disabled\"\n />\n )}\n </Status>\n <OrgCredentialsButton integration={integration} />\n </Flex>\n </Flex>\n </CardList.Item>\n );\n })}\n </>\n );\n}\n\ninterface PipesAdminSectionsProps extends PipesAdminProps {\n /**\n * Organization-owned integrations, as returned by the organization\n * endpoint. Empty while loading, when the organization owns nothing, and\n * when the request failed.\n */\n sharedIntegrations: OrganizationDataIntegration[];\n /** Renders the shared section as skeleton rows while it resolves. */\n isSharedLoading?: boolean;\n /** Names the owning organization in the shared section's description. */\n organizationName?: string;\n}\n\n/**\n * The sectioned administrator experience: the connections the organization\n * owns and shares with everyone, then the provider settings governing what\n * members may connect on their own. The two lanes come from different\n * endpoints and are never merged — the same provider can legitimately appear\n * in both, once as the organization's own account and once as the policy for\n * members' personal accounts.\n *\n * The shared section is omitted when the organization owns nothing or the\n * request failed, leaving provider settings on their own.\n */\nconst PipesAdminSections: React.FC<PipesAdminSectionsProps> = ({\n integrations,\n sharedIntegrations,\n isSharedLoading,\n organizationName,\n ...domProps\n}) => {\n return (\n <Flex\n direction=\"column\"\n gap=\"5\"\n {...getWidgetRootDomProps(\"resolved\", domProps)}\n >\n {(isSharedLoading || sharedIntegrations.length > 0) && (\n <PipesSection\n title={\n <Translation\n defaultMessage=\"Shared connections\"\n id=\"Fcd-bK\"\n description=\"Heading for the section listing connections the organization owns\"\n />\n }\n description={\n organizationName ? (\n <Translation\n defaultMessage=\"Accounts {organizationName} owns and shares with everyone.\"\n id=\"7U8P0v\"\n description=\"Description of the shared connections section, naming the organization\"\n values={{ organizationName }}\n />\n ) : (\n <Translation\n defaultMessage=\"Accounts your organization owns and shares with everyone.\"\n id=\"72FEZi\"\n description=\"Description of the shared connections section when the organization name is unknown\"\n />\n )\n }\n >\n <CardList.Root>\n {isSharedLoading ? (\n <PipesAdminSkeletonItems count={2} />\n ) : (\n sharedIntegrations.map((integration) => (\n <SharedConnectionAdminItem\n key={integration.id}\n integration={integration}\n />\n ))\n )}\n </CardList.Root>\n </PipesSection>\n )}\n <PipesSection\n title={\n <Translation\n defaultMessage=\"Provider settings\"\n id=\"Zq7Lr3\"\n description=\"Heading for the section of provider settings governing members' own connections\"\n />\n }\n description={\n <Translation\n defaultMessage=\"What members of this organization can connect to, and with which scopes.\"\n id=\"c3Vb8N\"\n description=\"Description of the provider settings section\"\n />\n }\n >\n <CardList.Root>\n {integrations.length > 0 ? (\n integrations.map((integration) => (\n <ProviderSettingsItem\n key={integration.id}\n integration={integration}\n />\n ))\n ) : (\n <PipesEmptyItem isFiltered={false} />\n )}\n </CardList.Root>\n </PipesSection>\n </Flex>\n );\n};\n\nfunction PipesAdminSkeletonItems({ count }: { count: number }) {\n return Array.from({ length: count }).map((_, index) => (\n <CardList.Item key={index}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Skeleton>\n <IconPanel>\n <ProviderIcon provider=\"google\" size=\"2\" />\n </IconPanel>\n </Skeleton>\n <Skeleton>\n <Text size=\"2\" weight=\"bold\">\n <Translation\n defaultMessage=\"Google Drive\"\n id=\"g11OOu\"\n description=\"Placeholder text for loading state\"\n />\n </Text>\n </Skeleton>\n </Flex>\n <Skeleton>\n <Button variant=\"secondary\" disabled>\n <Translation\n defaultMessage=\"Configure\"\n id=\"ADidi3\"\n description=\"Button to configure organization credentials\"\n />\n </Button>\n </Skeleton>\n </Flex>\n </CardList.Item>\n ));\n}\n\ninterface PipesAdminLoadingProps extends WidgetRootDomProps {\n count: number;\n}\n\nconst PipesAdminLoading: React.FC<PipesAdminLoadingProps> = ({\n count,\n ...domProps\n}) => {\n return (\n <CardList.Root {...getWidgetRootDomProps(\"loading\", domProps)}>\n <PipesAdminSkeletonItems count={count} />\n </CardList.Root>\n );\n};\n\ninterface PipesAdminErrorProps extends WidgetRootDomProps {\n error: unknown;\n}\n\nconst PipesAdminError: React.FC<PipesAdminErrorProps> = ({\n error,\n ...domProps\n}) => {\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"error\", domProps)}>\n <GenericError error={error} />\n </Card>\n );\n};\n\nexport type {\n PipesAdminProps,\n PipesAdminSectionsProps,\n PipesAdminLoadingProps,\n PipesAdminErrorProps,\n};\nexport {\n PipesAdmin,\n PipesAdminSections,\n PipesAdminLoading,\n PipesAdminError,\n useManageableIntegrations,\n useOrganizationOwnedIntegrations,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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G,sBAAsB,SAAS,QAAQ,GACxD,sDAAC,qCAAa,OAAc,GAC9B;AAEJ;","names":["error"]}
@@ -1,9 +1,9 @@
1
- import { DataIntegrationConfiguration } from '../api/endpoint.cjs';
1
+ import * as React from 'react';
2
+ import { DataIntegrationConfiguration, OrganizationDataIntegration } from '../api/endpoint.cjs';
2
3
  import { WidgetRootDomProps } from './utils.cjs';
3
4
  import '@tanstack/react-query';
4
5
  import '../api/widgets-api-client.cjs';
5
6
  import './elements.cjs';
6
- import 'react';
7
7
  import '@radix-ui/themes';
8
8
  import '@radix-ui/themes/props';
9
9
  import '../dialog-CGXwsXVe.cjs';
@@ -29,6 +29,18 @@ declare function useManageableIntegrations(): {
29
29
  isError: boolean;
30
30
  error: unknown;
31
31
  };
32
+ /**
33
+ * Integrations the organization owns and shares with everyone, with the
34
+ * organization's configuration and the actions the server allows on them.
35
+ * Gated on the same manage permission as provider settings, but cached
36
+ * separately so the two sections resolve independently. Like the member
37
+ * widget, a failed attempt drops the section rather than leaving skeletons up
38
+ * for the whole retry sequence.
39
+ */
40
+ declare function useOrganizationOwnedIntegrations(): {
41
+ data: OrganizationDataIntegration[];
42
+ isLoading: boolean;
43
+ };
32
44
  interface PipesAdminProps extends WidgetRootDomProps {
33
45
  integrations: DataIntegrationConfiguration[];
34
46
  }
@@ -38,6 +50,30 @@ interface PipesAdminProps extends WidgetRootDomProps {
38
50
  * Presentational — the client wrapper fetches via `useManageableIntegrations`.
39
51
  */
40
52
  declare const PipesAdmin: React.FC<PipesAdminProps>;
53
+ interface PipesAdminSectionsProps extends PipesAdminProps {
54
+ /**
55
+ * Organization-owned integrations, as returned by the organization
56
+ * endpoint. Empty while loading, when the organization owns nothing, and
57
+ * when the request failed.
58
+ */
59
+ sharedIntegrations: OrganizationDataIntegration[];
60
+ /** Renders the shared section as skeleton rows while it resolves. */
61
+ isSharedLoading?: boolean;
62
+ /** Names the owning organization in the shared section's description. */
63
+ organizationName?: string;
64
+ }
65
+ /**
66
+ * The sectioned administrator experience: the connections the organization
67
+ * owns and shares with everyone, then the provider settings governing what
68
+ * members may connect on their own. The two lanes come from different
69
+ * endpoints and are never merged — the same provider can legitimately appear
70
+ * in both, once as the organization's own account and once as the policy for
71
+ * members' personal accounts.
72
+ *
73
+ * The shared section is omitted when the organization owns nothing or the
74
+ * request failed, leaving provider settings on their own.
75
+ */
76
+ declare const PipesAdminSections: React.FC<PipesAdminSectionsProps>;
41
77
  interface PipesAdminLoadingProps extends WidgetRootDomProps {
42
78
  count: number;
43
79
  }
@@ -47,4 +83,4 @@ interface PipesAdminErrorProps extends WidgetRootDomProps {
47
83
  }
48
84
  declare const PipesAdminError: React.FC<PipesAdminErrorProps>;
49
85
 
50
- export { PipesAdmin, PipesAdminError, type PipesAdminErrorProps, PipesAdminLoading, type PipesAdminLoadingProps, type PipesAdminProps, useManageableIntegrations };
86
+ export { PipesAdmin, PipesAdminError, type PipesAdminErrorProps, PipesAdminLoading, type PipesAdminLoadingProps, type PipesAdminProps, PipesAdminSections, type PipesAdminSectionsProps, useManageableIntegrations, useOrganizationOwnedIntegrations };
@@ -29,10 +29,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
30
  var pipes_exports = {};
31
31
  __export(pipes_exports, {
32
+ ApiKeyDialog: () => ApiKeyDialog,
33
+ ClientCredentialsDialog: () => ClientCredentialsDialog,
34
+ ConnectDialog: () => ConnectDialog,
32
35
  Pipes: () => Pipes,
36
+ PipesEmptyItem: () => PipesEmptyItem,
33
37
  PipesError: () => PipesError,
34
38
  PipesLoading: () => PipesLoading,
35
- PipesSections: () => PipesSections
39
+ PipesSection: () => PipesSection,
40
+ PipesSections: () => PipesSections,
41
+ getUnpinnedInstallationFields: () => getUnpinnedInstallationFields,
42
+ useOpenDataIntegrationAuthorizeUrl: () => useOpenDataIntegrationAuthorizeUrl
36
43
  });
37
44
  module.exports = __toCommonJS(pipes_exports);
38
45
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -60,8 +67,16 @@ const CONNECT_AUTH_METHODS = [
60
67
  "client_credentials",
61
68
  "api_key"
62
69
  ];
63
- const useOpenDataIntegrationAuthorizeUrl = (integration) => {
70
+ const useAuthorizeConnection = (owner) => {
64
71
  const authorizeDataIntegration = (0, import_endpoint.useAuthorizeDataIntegrationHook)();
72
+ const authorizeOrganizationDataIntegration = (0, import_endpoint.useAuthorizeOrganizationDataIntegrationHook)();
73
+ return (0, import_react.useCallback)(
74
+ (slug, config) => owner === "organization" ? authorizeOrganizationDataIntegration(slug, { config }) : authorizeDataIntegration(slug, { requireHandoff: true, config }),
75
+ [owner, authorizeDataIntegration, authorizeOrganizationDataIntegration]
76
+ );
77
+ };
78
+ const useOpenDataIntegrationAuthorizeUrl = (integration, owner = "user") => {
79
+ const authorizeDataIntegration = useAuthorizeConnection(owner);
65
80
  const settings = (0, import_endpoint.useSettings)();
66
81
  const baseUrl = settings.data?.authkitOrigin ?? "";
67
82
  const intervalRef = (0, import_react.useRef)(
@@ -96,10 +111,10 @@ const useOpenDataIntegrationAuthorizeUrl = (integration) => {
96
111
  }
97
112
  let authorization;
98
113
  try {
99
- authorization = await authorizeDataIntegration(integration.slug, {
100
- requireHandoff: true,
114
+ authorization = await authorizeDataIntegration(
115
+ integration.slug,
101
116
  config
102
- });
117
+ );
103
118
  } catch (error) {
104
119
  win.close();
105
120
  throw error;
@@ -411,14 +426,15 @@ function ConnectDialog({
411
426
  integration,
412
427
  fields,
413
428
  open,
414
- onOpenChange
429
+ onOpenChange,
430
+ owner = "user"
415
431
  }) {
416
432
  const initialStep = fields.length > 0 ? "fields" : "review";
417
433
  const [step, setStep] = (0, import_react.useState)(initialStep);
418
434
  const [submitError, setSubmitError] = (0, import_react.useState)(null);
419
435
  const [isSubmitting, setIsSubmitting] = (0, import_react.useState)(false);
420
436
  const configForm = useConfigFieldsForm(fields);
421
- const eventHandler = useOpenDataIntegrationAuthorizeUrl(integration);
437
+ const eventHandler = useOpenDataIntegrationAuthorizeUrl(integration, owner);
422
438
  const translate = (0, import_use_translation.useTranslation)();
423
439
  const genericConnectError = translate({
424
440
  defaultMessage: "We couldn't start the connection. Please try again.",
@@ -578,13 +594,31 @@ function ConnectIntegrationButton({
578
594
  ] });
579
595
  }
580
596
  const API_KEY_REDACTED_PREFIX = "\u2022\u2022\u2022\u2022";
597
+ function useInvalidateConnections(owner) {
598
+ const queryClient = (0, import_react_query.useQueryClient)();
599
+ return (0, import_react.useCallback)(() => {
600
+ if (owner === "organization") {
601
+ queryClient.invalidateQueries({
602
+ queryKey: (0, import_endpoint.getOrganizationDataIntegrationsQueryKey)()
603
+ });
604
+ queryClient.invalidateQueries({
605
+ queryKey: (0, import_endpoint.getSharedDataConnectionsQueryKey)()
606
+ });
607
+ } else {
608
+ queryClient.invalidateQueries({
609
+ queryKey: (0, import_endpoint.getMyDataIntegrationsQueryKey)()
610
+ });
611
+ }
612
+ }, [owner, queryClient]);
613
+ }
581
614
  function ApiKeyDialog({
582
615
  integration,
616
+ installation = integration.installation,
617
+ owner = "user",
583
618
  open,
584
619
  onOpenChange
585
620
  }) {
586
- const queryClient = (0, import_react_query.useQueryClient)();
587
- const installation = integration.installation;
621
+ const invalidateConnections = useInvalidateConnections(owner);
588
622
  const isRotation = installation?.auth_method === "api_key" && installation.state === "connected";
589
623
  const last4 = installation?.api_key_last_4;
590
624
  const maskedKey = last4 ? `${API_KEY_REDACTED_PREFIX}${last4}` : "";
@@ -595,21 +629,22 @@ function ApiKeyDialog({
595
629
  id: "MzSxEF",
596
630
  description: "Placeholder for the API key input field"
597
631
  });
632
+ const onUpserted = () => {
633
+ onOpenChange(false);
634
+ invalidateConnections();
635
+ };
636
+ const userUpsert = (0, import_endpoint.useUpsertDataIntegrationApiKey)({
637
+ mutation: { onSuccess: onUpserted }
638
+ });
639
+ const organizationUpsert = (0, import_endpoint.useUpsertOrganizationDataIntegrationApiKey)({
640
+ mutation: { onSuccess: onUpserted }
641
+ });
598
642
  const {
599
643
  mutate: upsertApiKey,
600
644
  error,
601
645
  reset,
602
646
  isPending
603
- } = (0, import_endpoint.useUpsertDataIntegrationApiKey)({
604
- mutation: {
605
- onSuccess: () => {
606
- onOpenChange(false);
607
- queryClient.invalidateQueries({
608
- queryKey: (0, import_endpoint.getMyDataIntegrationsQueryKey)()
609
- });
610
- }
611
- }
612
- });
647
+ } = owner === "organization" ? organizationUpsert : userUpsert;
613
648
  (0, import_react.useEffect)(() => {
614
649
  reset();
615
650
  }, [reset]);
@@ -750,12 +785,13 @@ function ApiKeyConnectButton({
750
785
  }
751
786
  function ClientCredentialsDialog({
752
787
  integration,
788
+ installation = integration.installation,
789
+ owner = "user",
753
790
  fields,
754
791
  open,
755
792
  onOpenChange
756
793
  }) {
757
- const queryClient = (0, import_react_query.useQueryClient)();
758
- const installation = integration.installation;
794
+ const invalidateConnections = useInvalidateConnections(owner);
759
795
  const isUpdate = installation?.auth_method === "client_credentials";
760
796
  const storedConfig = (0, import_react.useMemo)(
761
797
  () => isUpdate ? installation?.config ?? {} : {},
@@ -785,20 +821,21 @@ function ClientCredentialsDialog({
785
821
  description: "Placeholder for the client credentials client secret input"
786
822
  });
787
823
  const secretMissing = !clientSecret.trim() || (0, import_redacted_secret.isRedactedSecret)(clientSecret);
824
+ const onUpserted = () => {
825
+ onOpenChange(false);
826
+ invalidateConnections();
827
+ };
828
+ const userUpsert = (0, import_endpoint.useUpsertDataIntegrationClientCredentials)({
829
+ mutation: { onSuccess: onUpserted }
830
+ });
831
+ const organizationUpsert = (0, import_endpoint.useUpsertOrganizationDataIntegrationClientCredentials)({
832
+ mutation: { onSuccess: onUpserted }
833
+ });
788
834
  const {
789
835
  mutate: upsertClientCredentials,
790
836
  error,
791
837
  isPending
792
- } = (0, import_endpoint.useUpsertDataIntegrationClientCredentials)({
793
- mutation: {
794
- onSuccess: () => {
795
- onOpenChange(false);
796
- queryClient.invalidateQueries({
797
- queryKey: (0, import_endpoint.getMyDataIntegrationsQueryKey)()
798
- });
799
- }
800
- }
801
- });
838
+ } = owner === "organization" ? organizationUpsert : userUpsert;
802
839
  const errorMessage = error instanceof import_errors.ApiError && error.message ? error.message : null;
803
840
  const handleSubmit = () => {
804
841
  if (!configForm.validate()) {
@@ -1810,9 +1847,16 @@ function getWidgetRootDomProps(state, domProps) {
1810
1847
  }
1811
1848
  // Annotate the CommonJS export names for ESM import in node:
1812
1849
  0 && (module.exports = {
1850
+ ApiKeyDialog,
1851
+ ClientCredentialsDialog,
1852
+ ConnectDialog,
1813
1853
  Pipes,
1854
+ PipesEmptyItem,
1814
1855
  PipesError,
1815
1856
  PipesLoading,
1816
- PipesSections
1857
+ PipesSection,
1858
+ PipesSections,
1859
+ getUnpinnedInstallationFields,
1860
+ useOpenDataIntegrationAuthorizeUrl
1817
1861
  });
1818
1862
  //# sourceMappingURL=pipes.cjs.map