@agiens/auth-ui

中文文档
0.1.3发布于 2026/08/15TypeScriptES Module近 30 天下载 1.2万

React screens + for BOS auth, built on @agiens/auth-core. Self-contained (no HeroUI/router dependency).

原始使用文档
文档目录4 节
  1. Install
  2. Use the exact BOS look
  3. Auth core wiring
  4. Published surface

@agiens/auth-ui

React auth screens for BOS surfaces. BosAuthWidget renders the same eight-screen flow used by bos.pro: login, signup, forgot password, reset password, verify email, auth verification, invitation acceptance, and profile completion.

Install

npm install @agiens/auth-ui @agiens/auth-core @base-ui/react react react-dom

The package is self-contained. It does not require BOS source imports, a BOS-hosted logo path, a specific router, or BOS application CSS.

Use the exact BOS look

Version 0.1.3 includes the BOS brand marks in the bundle and ships the current bos.pro light/dark palette as its default tokens. To make the visual contract explicit, pass the exported defaults as shown below and do not replace them with app-specific tokens or logos:

import {
  BosAuthWidget,
  createBrowserNavAdapter,
  defaultLogoUrl,
  defaultLogoUrlDark,
  defaultTokens,
} from '@agiens/auth-ui'

const config = {
  ops,       // createAuthOps({ client: bosAuth.client, ... })
  session,   // getCurrentUser + signOut wrappers for the same client
  nav: createBrowserNavAdapter(),
  providers: ['password', 'google', 'github', 'magic-link'],
  emailVerification: 'branded-edge-fn',
  onSuccessRedirect: '/',
  theme: {
    tokens: defaultTokens,
    logoUrl: defaultLogoUrl,
    logoUrlDark: defaultLogoUrlDark,
  },
}

export function AuthRoute() {
  return <BosAuthWidget config={config} />
}

Omitting theme is also equivalent: the widget applies these same embedded logos and fallback tokens automatically. The two logo values are data URLs, so external apps do not need to copy /logo/icon-dark.png, add a public asset, or depend on bos.pro for an image request. The widget chooses the light-ink mark on dark surfaces and the dark-ink mark on light surfaces.

To keep parity, do not override theme.tokens, logoUrl, or logoUrlDark. Host CSS variables such as --accent can intentionally customize the appearance; that is a brand fork, not the bos.pro default.

Auth core wiring

Create one BOS auth client and give its client to createAuthOps; the UI kit never creates a second Supabase client:

import { createAuthOps, createBosAuth } from '@agiens/auth-core'

const bosAuth = createBosAuth({
  supabase: {
    url: import.meta.env.VITE_SUPABASE_URL,
    publishableKey: import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY,
  },
})

const ops = createAuthOps({
  client: bosAuth.client,
  getOrigin: () => window.location.origin,
  emailVerification: 'branded-edge-fn',
})

The host supplies the small app-specific adapters (session, nav, invitation acceptance, and optional signup hooks). Behavior stays in the shared widget; differences belong in configuration.

Published surface

@agiens/auth-ui exports BosAuthWidget, all eight screens, browser/hash/memory navigation adapters, provider buttons, defaultTokens, defaultLogoUrl, defaultLogoUrlDark, and the BosAuthUiConfig types. Pair it with the matching @agiens/auth-core release.

版本与发布记录

@agiens/auth-ui 共发布 4 个版本,首次发布于 2026/07/10;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.1.3latest2026/08/152 个月前
0.1.22026/08/152 个月前
0.1.12026/07/113 个月前
0.1.02026/07/103 个月前

关于 @agiens/auth-ui 的常见问题

@agiens/auth-ui 是什么?

React screens + for BOS auth, built on @agiens/auth-core. Self-contained (no HeroUI/router dependency).

如何安装 @agiens/auth-ui?

在项目目录运行 npm install @agiens/auth-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、react-dom(>=18)、@base-ui/react(>=1.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agiens/auth-ui 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agiens/auth-ui 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agiens/auth-ui 可以商用吗?

@agiens/auth-ui 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@agiens/auth-ui 的下载量有多少?

根据 npm 官方下载统计,@agiens/auth-ui 在 2026/10/05 – 2026/11/03 这 30 天内被下载 11,986 次,日均约 400 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agiens/auth-ui 还在维护吗?

最新版本 0.1.3 发布于 2026/08/15(2 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/07/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。