Skip to content

feat(auth,integrations): Tangle login + integrations panel primitives#46

Merged
drewstone merged 1 commit into
mainfrom
feat/tangle-auth-integrations-primitives
May 19, 2026
Merged

feat(auth,integrations): Tangle login + integrations panel primitives#46
drewstone merged 1 commit into
mainfrom
feat/tangle-auth-integrations-primitives

Conversation

@drewstone
Copy link
Copy Markdown
Contributor

Summary

Two shared primitives every agent app (gtm/tax/legal/creative) needs but was forking locally — pulled into sandbox-ui so they live in one place.

  • auth: TangleLoginButton mirrors GitHubLoginButton (redirects to a consumer-side /auth/tangle endpoint that wraps PlatformAuthClient.authorizeUrl). AuthHeader gains a provider: "github" | "tangle" prop (defaults to "github" for backcompat).
  • ./integrations (new subpath): IntegrationsPanel (presentational, OAuth-only) + useIntegrations data hook against a consumer's /api/integrations/hub/* shim over PlatformHubClient. Healthchecks are best-effort — a 404 there doesn't fail the panel.

15 RTL tests cover the new surfaces.

Coordinated PRs

This PR pairs with:

  • agent-runtime: typed clients (./platform subpath)
  • platform: TRUSTED_APPS registry + 4 new agent app ids
  • gtm/tax/legal/creative: consume these primitives

Test plan

  • pnpm test (Vitest + jsdom) — 15 new cases green
  • pnpm builddist/integrations.js, dist/integrations.d.ts, dist/auth.js resolve
  • Manual: TangleLoginButton in Storybook redirects to /auth/tangle
  • Manual: IntegrationsPanel renders catalog + connections + revoked-as-Connect fallback

…ives

Two new primitives every Tangle agent app needs.

Sits inside the shim era (post-#11): `auth/index.ts` keeps re-exporting
GitHubLoginButton/AuthHeader/UserMenu from `@tangle-network/ui/auth`,
and now adds a locally-owned `TangleLoginButton` alongside. The
integrations primitive is fully sandbox-ui-owned (no @tangle-network/ui
counterpart yet) and exposed via a new `./integrations` subpath.

TangleLoginButton (`src/auth/tangle-login-button.tsx`)
  Mirrors `GitHubLoginButton`'s redirect-on-click shape. Server side,
  the consumer routes the configured `authUrl` (default `/auth/tangle`)
  through `PlatformAuthClient.authorizeUrl(...)` from
  `@tangle-network/agent-runtime/platform`.

IntegrationsPanel + useIntegrations (`src/integrations/*`)
  Purely presentational panel — takes catalog, connections, optional
  health map, `onConnect`/`onDisconnect`. One Card per catalog
  provider; revoked connections fall back to the Connect button
  rather than masquerading as live. EmptyState handles "no providers"
  and "loading from cold".

  The data hook expects a thin REST shim (`GET catalog`, `GET
  connections`, `GET healthchecks`, `POST auth/start`, `DELETE
  connections/:id`) the consumer mounts over `PlatformHubClient`.
  `connect()` redirects via `window.location.href`; `disconnect()`
  refreshes the connection list. Healthchecks are best-effort — a
  404/error there does not fail the whole panel load.

  Type shapes live in `./types` (mirrors the platform's
  `/v1/integrations/*` response) so the UI package does not depend on
  the server-side client at all.

Test coverage (14 cases, `@testing-library/react`):
  - TangleLoginButton: default authUrl, custom authUrl, custom label
  - Panel: catalog render, Connect→callback, Disconnect→callback,
           revoked-as-Connect, error state, empty state, health badge
  - Hook: autoLoad path, connect→redirect, connect→error surface,
           disconnect→refresh

tsup gets a new `integrations` entry; `package.json` gets the
matching `./integrations` export. No version bump — releases land in
their own dedicated commits per the repo's existing pattern.
@drewstone drewstone force-pushed the feat/tangle-auth-integrations-primitives branch from 3366c59 to 345065f Compare May 19, 2026 05:30
@drewstone drewstone merged commit 4621b06 into main May 19, 2026
1 check passed
drewstone added a commit that referenced this pull request May 19, 2026
Triggers Auto Release & Publish for the TangleLoginButton + ./integrations subpath added in #46.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant