@channel.io/app-sdk-wam-ui

中文文档
0.4.1发布于 2026/07/27MITTypeScriptES Module零依赖近 30 天下载 5.3万

WAM-specific UI infrastructure and Bezier presets for Channel.io apps

原始使用文档
文档目录14 节
  1. Installation
  2. Quick start
  3. Bezier usage
  4. Components
  5. WamThemeProvider
  6. HeightSynchronizer
  7. WamHeader
  8. LoadingPage , ErrorPage , and EmptyState
  9. InlineBanner
  10. ConfirmDialog
  11. SkeletonBox , SkeletonCircle , and BottomSheet
  12. Examples
  13. Peer dependencies
  14. License

@channel.io/app-sdk-wam-ui

WAM-specific UI infrastructure and presets for Channel.io apps.

Use this package for WAM runtime behavior such as theme detection, iframe height synchronization, navigation, and common full-page states. Import general-purpose UI components directly from the redesigned Bezier subpath.

Installation

npm install @channel.io/app-sdk-wam-ui
npm install react @channel.io/[email protected] @channel.io/[email protected] styled-components@^6

Bezier React 4 is still a prerelease. Pin 4.0.0-next.14 in application lockfiles and review its release notes before upgrading.

Quick start

import { SendIcon } from "@channel.io/bezier-icons";
import { Button, HStack } from "@channel.io/bezier-react/beta";
import {
  HeightSynchronizer,
  InlineBanner,
  WamHeader,
  WamThemeProvider,
} from "@channel.io/app-sdk-wam-ui";

export function App() {
  return (
    <WamThemeProvider>
      <HeightSynchronizer maxHeight={480}>
        <WamHeader title="Example" />
        <HStack spacing={8} padding={16}>
          <Button label="Send" leadingContent={SendIcon} variant="filled" semantic="primary" />
        </HStack>
        <InlineBanner variant="info" content="Ready to send." />
      </HeightSynchronizer>
    </WamThemeProvider>
  );
}

Bezier usage

New WAM interfaces should import redesigned components from @channel.io/bezier-react/beta:

import {
  Banner,
  Button,
  ConfirmModal,
  FormField,
  Search,
  Select,
  SettingsField,
  Switch,
  TextInput,
} from "@channel.io/bezier-react/beta";

Provider and stable token APIs that are not exported by the beta subpath remain available from @channel.io/bezier-react. Import UI components from /beta and use the current token APIs.

Components

WamThemeProvider

Wraps a WAM with Bezier's AppProvider and redesigned ToastProvider. It detects the light or dark appearance from the WAM runtime, or accepts an explicit override.

<WamThemeProvider>
  <MyWam />
</WamThemeProvider>

HeightSynchronizer

Observes content changes and synchronizes the current iframe height through the host bridge.

<HeightSynchronizer maxHeight={600}>
  <MyContent />
</HeightSynchronizer>

Use excludePaths with pathname when a route manages its own size.

WamHeader

Provides WAM back and close behavior with Bezier beta icon buttons. Pass WAM SDK navigation and close callbacks when the surrounding app controls those actions.

<WamHeader title="Settings" showBackButton />

LoadingPage, ErrorPage, and EmptyState

Consistent full-page states for small WAM surfaces.

if (loading) return <LoadingPage message="Loading data..." />;
if (error) return <ErrorPage error={error} onRetry={refetch} />;
return <EmptyState title="No results" description="Try a different search." />;

InlineBanner

A semantic success, error, or information preset over Bezier beta Banner.

<InlineBanner variant="success" content="Saved successfully." />

ConfirmDialog

A compact confirmation preset over Bezier beta ConfirmModal.

<ConfirmDialog
  show={open}
  onHide={() => setOpen(false)}
  title="Delete this item?"
  description="This action cannot be undone."
  destructive
  confirmText="Delete"
  onConfirm={handleDelete}
/>

SkeletonBox, SkeletonCircle, and BottomSheet

WAM-oriented loading placeholders and compact overlay layouts that do not have a direct Bezier beta equivalent. Give every BottomSheet an ariaLabel; it manages focus, Escape, and scroll locking while open.

Examples

Both tutorials show a React WAM using @channel.io/app-sdk-wam and this package alongside a language-specific app server.

Peer dependencies

PackageVersion
react>=17.0.0
@channel.io/bezier-react>=4.0.0-next.14 <5.0.0
@channel.io/bezier-icons>=0.60.0 <1.0.0
styled-components>=6.0.0

Apps still using Bezier 3 should remain on @channel.io/app-sdk-wam-ui 0.2.x.

License

MIT

版本与发布记录

@channel.io/app-sdk-wam-ui 共发布 6 个版本,首次发布于 2026/04/01;过去 12 个月发布了 6 个版本。

版本发布日期距今
0.4.1latest2026/07/273 个月前
0.4.02026/07/223 个月前
0.3.02026/07/223 个月前
0.2.22026/07/014 个月前
0.2.12026/04/017 个月前
0.2.02026/04/017 个月前

关于 @channel.io/app-sdk-wam-ui 的常见问题

@channel.io/app-sdk-wam-ui 是什么?

WAM-specific UI infrastructure and Bezier presets for Channel.io apps

如何安装 @channel.io/app-sdk-wam-ui?

在项目目录运行 npm install @channel.io/app-sdk-wam-ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@channel.io/bezier-icons(>=0.60.0 <1.0.0)、@channel.io/bezier-react(>=4.0.0-next.14 <5.0.0)、react(>=17.0.0)、styled-components(>=6.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@channel.io/app-sdk-wam-ui 支持 TypeScript 吗?

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

@channel.io/app-sdk-wam-ui 支持 ESM 还是 CommonJS?

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

@channel.io/app-sdk-wam-ui 可以商用吗?

@channel.io/app-sdk-wam-ui 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@channel.io/app-sdk-wam-ui 的下载量有多少?

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

@channel.io/app-sdk-wam-ui 还在维护吗?

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