iblai-invite
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/iblai-invite
/iblai-invite
Add user invitation features -- a dialog to invite new users to a tenant by
email/username and a dialog showing pending invitations with status tracking.
AI Assistant: Do NOT add custom styles, colors, or CSS overrides to ibl.ai SDK components. They ship with their own styling. Keep the components as-is. Do NOT implement dark mode unless the user explicitly asks for it.When building custom UI around SDK components, use the ibl.ai brand:
- Primary:
, Gradient:#0058cclinear-gradient(135deg, #00b0ef, #0058cc)- Button:
bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white- Font: System sans-serif stack, Style: shadcn/ui new-york variant
- Use shadcn components for custom UI -- they share the same Tailwind theme and render in ibl.ai brand colors automatically.
You MUST runbefore telling the user the work is ready./iblai-testAfter all work is complete, start a dev server () so the user can see the result at http://localhost:3000.pnpm devis NOT aiblai.envreplacement — it only holds the 3 shorthand variables (.env.local,DOMAIN,PLATFORM). Next.js still reads its runtime env vars fromTOKEN..env.localUseas the default package manager. Fall back topnpmif pnpm is not installed. The generated app should live in the current directory, not in a subdirectory.npm
添加用户邀请功能——包含一个通过邮箱/用户名向租户邀请新用户的对话框,以及一个展示待处理邀请并支持状态追踪的对话框。
AI Assistant: 请勿为 ibl.ai SDK 组件添加自定义样式、颜色或 CSS 覆盖。它们自带默认样式,请保持组件原样。除非用户明确要求,否则不要实现深色模式。在 SDK 组件之外构建自定义 UI 时,请遵循 ibl.ai 品牌规范:
- 主色:
, 渐变色:#0058cclinear-gradient(135deg, #00b0ef, #0058cc)- 按钮:
bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white- 字体: 系统无衬线字体栈, 样式: shadcn/ui new-york 变体
- 自定义 UI 请使用 shadcn 组件——它们共用同一套 Tailwind 主题,会自动适配 ibl.ai 品牌色。
告知用户工作已完成前,你必须先运行。/iblai-test所有工作完成后,启动开发服务器(),用户即可在 http://localhost:3000 查看效果。pnpm dev不能替代iblai.env——它仅存储3个简写变量(.env.local、DOMAIN、PLATFORM)。Next.js 仍会从TOKEN读取运行时环境变量。.env.local默认使用作为包管理器,若未安装 pnpm 则回退到pnpm。生成的应用需放在当前目录下,不要放在子目录中。npm
Prerequisites
前置条件
- Auth must be set up first ()
/iblai-auth - MCP and skills must be set up:
iblai add mcp - User must have admin privileges on the tenant to send invitations
- 需先完成 Auth 配置()
/iblai-auth - 需完成 MCP 和 skill 配置:运行
iblai add mcp - 用户需拥有租户的管理员权限才能发送邀请
Step 0: Check for CLI Updates
步骤0:检查 CLI 更新
Before running any command, ensure the CLI is
up to date. Run to check the current version, then
upgrade directly:
iblaiiblai --version- pip:
pip install --upgrade iblai-app-cli - npm:
npm install -g @iblai/cli@latest
This is safe to run even if already at the latest version.
运行任何 命令前,请先确保 CLI 是最新版本。运行 查看当前版本,然后直接升级:
iblaiiblai --version- pip:
pip install --upgrade iblai-app-cli - npm:
npm install -g @iblai/cli@latest
即使当前已经是最新版本,运行该命令也是安全的。
Step 1: Check Environment
步骤1:检查环境
Before proceeding, check for a
in the project root. Look for , , and variables.
If the file does not exist or is missing these variables, tell the user:
"You need an with your platform configuration. Download the
template and fill in your values:
"
iblai.envPLATFORMDOMAINTOKENiblai.envcurl -o iblai.env https://raw.githubusercontent.com/iblai/vibe/refs/heads/main/iblai.env继续操作前,请检查项目根目录是否存在 文件,确认包含 、 和 变量。如果文件不存在或缺少这些变量,请告知用户:
"你需要一个包含平台配置的 文件。下载模板并填写你的配置值:
"
iblai.envPLATFORMDOMAINTOKENiblai.envcurl -o iblai.env https://raw.githubusercontent.com/iblai/vibe/refs/heads/main/iblai.envStep 2: Add the Components
步骤2:添加组件
There is no dedicated CLI generator for invite dialogs. Import the components
directly from the SDK:
typescript
import { InviteUserDialog, InvitedUsersDialog } from "@iblai/iblai-js/web-containers";邀请对话框没有专属的 CLI 生成器,直接从 SDK 导入组件即可:
typescript
import { InviteUserDialog, InvitedUsersDialog } from "@iblai/iblai-js/web-containers";Step 3: Use MCP Tools for Customization
步骤3:使用 MCP 工具自定义
get_component_info("InviteUserDialog")
get_component_info("InvitedUsersDialog")get_component_info("InviteUserDialog")
get_component_info("InvitedUsersDialog")<InviteUserDialog>
Props
<InviteUserDialog><InviteUserDialog>
属性
<InviteUserDialog>Dialog to invite a user to the current tenant by email or username.
| Prop | Type | Description |
|---|---|---|
| | Whether the dialog is visible |
| | Close callback |
| | Tenant/org key |
用于通过邮箱或用户名向当前租户邀请用户的对话框。
| Prop | 类型 | 描述 |
|---|---|---|
| | 对话框是否可见 |
| | 关闭回调函数 |
| | 租户/组织 key |
<InvitedUsersDialog>
Props
<InvitedUsersDialog><InvitedUsersDialog>
属性
<InvitedUsersDialog>Dialog showing pending invitations with their status (accepted, pending, expired).
| Prop | Type | Description |
|---|---|---|
| | Whether the dialog is visible |
| | Close callback |
| | Tenant/org key |
展示待处理邀请及其状态(已接受、待处理、已过期)的对话框。
| Prop | 类型 | 描述 |
|---|---|---|
| | 对话框是否可见 |
| | 关闭回调函数 |
| | 租户/组织 key |
Example Usage
使用示例
Add invite buttons to an admin settings page or account page:
tsx
"use client";
import { useState } from "react";
import { InviteUserDialog, InvitedUsersDialog } from "@iblai/iblai-js/web-containers";
import { Button } from "@/components/ui/button";
import { resolveAppTenant } from "@/lib/iblai/tenant";
export function InviteSection() {
const [showInvite, setShowInvite] = useState(false);
const [showPending, setShowPending] = useState(false);
const tenant = resolveAppTenant();
return (
<div className="flex gap-2">
<Button onClick={() => setShowInvite(true)}>Invite User</Button>
<Button variant="outline" onClick={() => setShowPending(true)}>
View Pending
</Button>
<InviteUserDialog
isOpen={showInvite}
onClose={() => setShowInvite(false)}
org={tenant}
/>
<InvitedUsersDialog
isOpen={showPending}
onClose={() => setShowPending(false)}
org={tenant}
/>
</div>
);
}在管理设置页面或账户页面添加邀请按钮:
tsx
"use client";
import { useState } from "react";
import { InviteUserDialog, InvitedUsersDialog } from "@iblai/iblai-js/web-containers";
import { Button } from "@/components/ui/button";
import { resolveAppTenant } from "@/lib/iblai/tenant";
export function InviteSection() {
const [showInvite, setShowInvite] = useState(false);
const [showPending, setShowPending] = useState(false);
const tenant = resolveAppTenant();
return (
<div className="flex gap-2">
<Button onClick={() => setShowInvite(true)}>Invite User</Button>
<Button variant="outline" onClick={() => setShowPending(true)}>
View Pending
</Button>
<InviteUserDialog
isOpen={showInvite}
onClose={() => setShowInvite(false)}
org={tenant}
/>
<InvitedUsersDialog
isOpen={showPending}
onClose={() => setShowPending(false)}
org={tenant}
/>
</div>
);
}Step 4: Verify
步骤4:验证
Run before telling the user the work is ready:
/iblai-test- -- must pass with zero errors
pnpm build - Start dev server and verify dialogs open correctly:
bash
pnpm dev & npx playwright screenshot http://localhost:3000 /tmp/invite.png
告知用户工作已完成前请运行 :
/iblai-test- -- 必须零错误通过
pnpm build - 启动开发服务器,验证对话框可正常打开:
bash
pnpm dev & npx playwright screenshot http://localhost:3000 /tmp/invite.png
Important Notes
重要注意事项
- Import: -- framework-agnostic
@iblai/iblai-js/web-containers - Admin only: Invitation features require admin privileges on the tenant
- Redux store: Must include and
mentorReducermentorMiddleware - : 5 args (v1.2+)
initializeDataLayer() - : Deduplicated via webpack aliases in
@reduxjs/toolkitnext.config.ts - Brand guidelines: BRAND.md
- 导入路径: -- 不绑定特定框架
@iblai/iblai-js/web-containers - 仅管理员可用: 邀请功能需要用户拥有租户的管理员权限
- Redux store: 必须包含 和
mentorReducermentorMiddleware - : 需传入5个参数(v1.2及以上版本)
initializeDataLayer() - : 通过
@reduxjs/toolkit中的 webpack 别名去重next.config.ts - 品牌规范: BRAND.md