@workos-inc/widgets 1.16.0-next.1785954585478 → 1.16.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 { ProviderIcon } from \"./provider-icon.js\";\nimport { isKnownProviderIconSlug } from \"./provider-icon-slugs.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\";\n\nconst REDACTED_SECRET_PREFIX = \"••••••••••••••••\";\n\n/** Masked display value for an existing secret: 16 bullets + the last 4 chars. */\nconst buildRedactedSecret = (last4: string | null | undefined): string =>\n last4 ? `${REDACTED_SECRET_PREFIX}${last4}` : \"\";\n\n/** True while the field still holds the unmodified redacted placeholder. */\nconst isRedactedSecret = (value: string): boolean =>\n value.startsWith(REDACTED_SECRET_PREFIX);\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 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 <ProviderIcon\n provider={\n isKnownProviderIconSlug(integration.integrationType)\n ? integration.integrationType\n : \"generic-oauth\"\n }\n />\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\" />\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, PipesAdminErrorPro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,0BAAC,YACC,8BAAC,aACC,8BAAC,gBAAa,UAAS,UAAS,GAClC,GACF;AAAA,MACA,oBAAC,YACC,8BAAC,QAAK,MAAK,KAAI,QAAO,QACpB;AAAA,QAAC;AAAA;AAAA,UACC,gBAAe;AAAA,UACf,IAAG;AAAA,UACH,aAAY;AAAA;AAAA,MACd,GACF,GACF;AAAA,OACF;AAAA,IACA,oBAAC,YACC,8BAAC,UAAO,SAAQ,aAAY,UAAQ,MAClC;AAAA,MAAC;AAAA;AAAA,QACC,gBAAe;AAAA,QACf,IAAG;AAAA,QACH,aAAY;AAAA;AAAA,IACd,GACF,GACF;AAAA,KACF,KA3BkB,KA4BpB,CACD,GACH;AAEJ;AAMA,MAAM,kBAAkD,CAAC;AAAA,EACvD;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE,oBAAC,QAAK,MAAK,KAAK,GAAG,sBAAsB,SAAS,QAAQ,GACxD,8BAAC,gBAAa,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 { useState } from \"react\";\nimport { InfoCircledIcon } from \"@radix-ui/react-icons\";\nimport * as CardList from \"./card-list.js\";\nimport { CopyText } from \"./copy-text.js\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport { isKnownProviderIconSlug } from \"./provider-icon-slugs.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 <ProviderIcon\n provider={\n isKnownProviderIconSlug(integration.integrationType)\n ? integration.integrationType\n : \"generic-oauth\"\n }\n />\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\" />\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":";AA4CI,SAucQ,UArcJ,KAFJ;AA3CJ,SAAS,SAAS,MAAM,MAAM,QAAQ,MAAM,eAAe;AAC3D,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,YAAY,cAAc;AAC1B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,cAAc;AACvB;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,mBAAwD;AACjE,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB,wBAAwB;AAEtD,SAAS,iBAAiB,EAAE,MAAM,GAAsB;AACtD,QAAM,YAAY,eAAe;AAEjC,QAAM,YAAY,UAAU;AAAA,IAC1B,gBAAgB;AAAA,IAChB,IAAI;AAAA,IACJ,aAAa;AAAA,EACf,CAAC;AAED,SACE,qBAAC,QAAK,WAAU,UAAS,KAAI,KAC3B;AAAA,wBAAC,SACC;AAAA,M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