Skip to content

bridge-react 1.0.0-alpha.1: the React plugin for the new Bridge, on auth-core 1.0 - #51

Open
iman-nebulr wants to merge 4 commits into
v1from
feat/v1-alpha
Open

iman-nebulr wants to merge 4 commits into
v1from
feat/v1-alpha

Conversation

@iman-nebulr

Copy link
Copy Markdown
Contributor

The React counterpart of @nebulr-group/bridge-svelte 1.0.0-alpha.8, on @nebulr-group/bridge-auth-core 1.0.0-alpha.8 (pinned exactly). One setting, the issuer. Every security step (tokens, PKCE, email links, hand-off, storage modes, revocation) stays in auth-core; this package is the React layer over it.

v1 is new: created from main (7381a5e) for this line, as bridge-svelte's. latest stays on 0.x.

What it has (svelte's public surface, React-idiomatic, same names, props, copy and data attributes)

  • <BridgeProvider config router>: the client, email links to their pages, flag-only route rules and the paywall flag, re-guarded on session and flag changes. Router-agnostic ({ location, navigate } from React Router, TanStack, Wouter; default the browser's history).
  • Hooks: useSession, useUser, useWorkspace, useWorkspaces, useMe, useFlag, useFlags, useBilling, usePlans, useUsage, useQuota, useLiveStatus, useCanManageBilling, useCanManageTeam…
  • Sign-in pages from one route (/auth/*): password, sign-in link, passkeys, hosted mode, hand-off, invites, workspaces, the too-many-attempts wait. Team panel. Plan picker, portal, subscription status, notices, quota banner, upgrade dialog via bridgeFetch.
  • Storage 'local' (default) or 'memory', as svelte. Copy in svelte's 12 languages.
  • Naming map: snippets → ReactNode/render props of the same name, onclose → onClose, key → flagKey, stores → hooks (table in learning/README.md).

Not ported: server helpers (/server): React has no server side; an API uses @nebulr-group/bridge-auth-core/server or the Express/NestJS plugins.

Tests (in containers)

  • tsc clean (plugin and demo), package builds and loads in Node.
  • Vitest: 50 passed (core ported from svelte, plus the provider's guard in jsdom under StrictMode).
  • Playwright: 57 passed against auth-core's fake issuer (the svelte suite minus the server-helpers spec; both the local and the memory-storage demo). Docs links and the networkidle guard pass.
  • Against stage: not run. Like bridge-svelte's suite, a real issuer needs a stage test app that lists the demo's origin and the issuer's test seams (making people, reading emailed links, setting flags), which do not exist yet.

https://claude.ai/code/session_01G1bV8Xv8bNjMNToHyYYCgW

…932)

The React counterpart of bridge-svelte 1.0.0-alpha.8 for the new Bridge:
one setting (the issuer), every security step in auth-core 1.0.0-alpha.8,
and the same pages, settings, copy (12 languages) and data attributes as
svelte, so docs and tests map one to one.

- BridgeProvider: makes the page's client, follows email links, guards
  every navigation with flag-only route rules and the paywall flag, and
  guards again when the session or flags change. Router-agnostic: it takes
  the app's router location and navigate, or the browser's history.
- Hooks for session, user, workspace, workspaces, me, flags, billing,
  plans, usage, live status; resources refresh on Live notices.
- Sign-in pages from one route (password, sign-in link, passkeys, hosted
  mode, hand-off, invites, workspaces, the wait message), the team panel,
  plan picker, subscription status, notices, upgrade dialog, bridgeFetch.
- Storage 'local' (default) or 'memory', as svelte.
- ESM only, React 18/19; 0.x sources, router subpaths and /flags removed.
- Unit tests: core (guard, config, copy in 12 locales, link relay, storage,
  client against auth-core's fake issuer) and the provider's guard in jsdom
  under StrictMode.

Refs: TBP-932
Claude-Session: https://claude.ai/code/session_01G1bV8Xv8bNjMNToHyYYCgW
…TBP-932)

The svelte 1.0 demo and specs, ported: React Router around
BridgeProvider (StrictMode), the same routes and rungs 0-4, and the
same specs against auth-core's fake issuer over HTTP, or a real issuer
with E2E_ISSUER. The app API is a Vite dev stand-in for the 402 at a
plan limit; the server-helpers spec is dropped, as React has no server.

Refs: TBP-932
Claude-Session: https://claude.ai/code/session_01G1bV8Xv8bNjMNToHyYYCgW
The svelte 1.0 guides, translated to the React package's real API, with
a Svelte-to-React names table so the two map one to one.

Refs: TBP-932
Claude-Session: https://claude.ai/code/session_01G1bV8Xv8bNjMNToHyYYCgW
PR gate, docs links, e2e guards and the install test run on PRs into
v1; the install test builds the 1.0 package and checks it loads with
React 18 and 19. No lockfile is tracked, as in bridge-svelte v1.

Refs: TBP-932
Claude-Session: https://claude.ai/code/session_01G1bV8Xv8bNjMNToHyYYCgW
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