@auth0/ul-context-inspector

中文文档
1.1.3发布于 2025/12/01Apache-2.0TypeScriptESM + CJS近 30 天下载 41.4万

Universal Login Inspector tool to inspect Auth0 ACUL context data.

原始使用文档
文档目录12 节
  1. ✅ What It Does
  2. 📦 1. Install
  3. 🗂 2. Local Manifest & Variant Files
  4. Manifest Shape
  5. 🧪 3. Mount the Panel
  6. � 4. Subscribe to Context Updates (Optional)
  7. �🕹 5. Interactive Behavior
  8. 🧩 Panel Props
  9. 🎨 Styling Notes
  10. 🛠 Development
  11. 🧾 License
  12. ❓ FAQ

Auth0 Universal Login Context Inspector

Universal Login Context Inspector screenshot

npm downloads react versions node typescript license vite

Developer panel for inspecting and previewing the Universal Login JSON context (window.universal_login_context) for the Advanced Customizations for Universal Login (ACUL) feature.


✅ What It Does

  1. Detects if a real tenant context exists ("connected" mode).
  2. If not, lets you preview screens & variants using a local or CDN manifest ("disconnected" mode).
  3. Lets you inspect & live-edit mock context JSON (broadcasts a custom event).
  4. Persists your selections (screen / variant / data source / version) in sessionStorage between reloads.

📦 1. Install

npm install @auth0/ul-context-inspector

Peer dependencies (install if you don’t already have them):

npm install react react-dom

🗂 2. Local Manifest & Variant Files

When the panel runs in disconnected mode it attempts to fetch a local manifest at GET /manifest.json:

  • If the request succeeds (HTTP 200), the data source switches to "Local development" automatically.
  • If it fails, the panel defaults to the Auth0 CDN manifest.

Place your manifest and variant JSON under public/ so Vite (or your bundler) serves them from the root:

public/
  manifest.json
  screens/
    login/
      login/
        default.json
        with-errors.json
    login-id/
      login-id/
        default.json
        with-errors.json

Manifest Shape

manifest.json contains an array screens with objects mapping prompt → screen → variant node:

{
  "screens": [
    {
      "login": {
        "login": { "path": "/screens/login/login", "variants": ["default", "with-errors"] }
      }
    },
    {
      "login-id": {
        "login-id": { "path": "/screens/login-id/login-id", "variants": ["default", "with-errors"] }
      }
    }
  ]
}

Each variant file is loaded at: <path>/<variant>.json (e.g. /screens/login/login/default.json).

If a node omits variants, the panel assumes a single default variant.


🧪 3. Mount the Panel

import { UniversalLoginContextPanel } from '@auth0/ul-context-inspector';

export function App() {
  return <UniversalLoginContextPanel defaultScreen="login:login" />;
}

defaultScreen uses prompt:screen format. If omitted and CDN mode is active, the panel may auto-select a common screen (e.g. login-id:login-id).


� 4. Subscribe to Context Updates (Optional)

Use the subscription hook if your host needs to re-render on context changes:

import { useUniversalLoginContextSubscription } from '@auth0/ul-context-inspector';

function Host() {
  const context = useUniversalLoginContextSubscription();
  return <pre>{JSON.stringify(context?.screen, null, 2)}</pre>;
}

�🕹 5. Interactive Behavior

  • Connected mode: If window.universal_login_context existed at mount, selections do not override real tenant context screen/variant.
  • Disconnected mode: Screen & variant selection reloads the page to simulate host SDK remount.
  • Persistence: Values stored in sessionStorage with prefix ulci:.
  • Local manifest auto-detection runs once at startup; if found, data source switches to Local.
  • Editing JSON: Writes directly to window.universal_login_context (even in mock mode) and triggers a broadcast event.

🧩 Panel Props

PropTypeDefaultDescription
defaultScreenstringundefinedInitial preview screen (prompt:screen) if no prior session selection.

🎨 Styling Notes

Tailwind classes are prefixed with uci-. If you purge CSS, safelist with a regex like /uci-/.


🛠 Development

npm install
npm run dev      # Start dev server
npm run build    # Produce dist (JS, types, CSS)

🧾 License

Apache-2.0


❓ FAQ

Why is my local manifest ignored?
Ensure public/manifest.json returns 200 and matches the shape above; check dev tools Network panel.

How do I force CDN mode?
Delete/rename local manifest.json or manually switch data source in the panel.

版本与发布记录

@auth0/ul-context-inspector 共发布 5 个版本,首次发布于 2025/11/15;过去 12 个月发布了 5 个版本。

版本发布日期距今
1.1.3latest2025/12/0111 个月前
1.1.22025/11/2011 个月前
1.1.12025/11/1811 个月前
1.1.02025/11/1511 个月前
1.0.02025/11/1511 个月前

关于 @auth0/ul-context-inspector 的常见问题

@auth0/ul-context-inspector 是什么?

Universal Login Inspector tool to inspect Auth0 ACUL context data.

如何安装 @auth0/ul-context-inspector?

在项目目录运行 npm install @auth0/ul-context-inspector,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.3.1 || ^19.0.0)、react-dom(^18.3.1 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@auth0/ul-context-inspector 支持 TypeScript 吗?

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

@auth0/ul-context-inspector 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@auth0/ul-context-inspector 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@auth0/ul-context-inspector 可以商用吗?

@auth0/ul-context-inspector 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@auth0/ul-context-inspector 的下载量有多少?

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

@auth0/ul-context-inspector 还在维护吗?

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