feat(auth,integrations): Tangle login + integrations panel primitives#46
Merged
Merged
Conversation
…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.
3366c59 to
345065f
Compare
drewstone
added a commit
that referenced
this pull request
May 19, 2026
Triggers Auto Release & Publish for the TangleLoginButton + ./integrations subpath added in #46.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:TangleLoginButtonmirrorsGitHubLoginButton(redirects to a consumer-side/auth/tangleendpoint that wrapsPlatformAuthClient.authorizeUrl).AuthHeadergains aprovider: "github" | "tangle"prop (defaults to "github" for backcompat)../integrations(new subpath):IntegrationsPanel(presentational, OAuth-only) +useIntegrationsdata hook against a consumer's/api/integrations/hub/*shim overPlatformHubClient. 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:
./platformsubpath)Test plan
pnpm test(Vitest + jsdom) — 15 new cases greenpnpm build—dist/integrations.js,dist/integrations.d.ts,dist/auth.jsresolveTangleLoginButtonin Storybook redirects to/auth/tangleIntegrationsPanelrenders catalog + connections + revoked-as-Connect fallback