@dialstack/sdk-react

中文文档
3.10.0发布于 2026/11/10MITTypeScriptESM + CJS近 30 天下载 3725

React components and hooks for the DialStack SDK — call logs, voicemails, dial plan, softphone and onboarding

原始使用文档
文档目录6 节
  1. Install
  2. One import path per component
  3. The softphone needs no initializer
  4. Everything else needs one
  5. Documentation
  6. License

@dialstack/sdk-react

React components and hooks for the DialStack SDK — call logs, voicemails, call history, phone numbers, number ordering, AI agent, the dial-plan editor, the softphone and onboarding.

Install

npm install @dialstack/sdk-js @dialstack/sdk-react react react-dom

Two of those need explaining.

@dialstack/sdk-js is a peer, not a dependency, the same way @stripe/react-connect-js peers on @stripe/connect-js: you install both, and you call the initializer yourself. npm 7+ installs a missing peer automatically, so in practice this is one command.

@xyflow/react is a peer too, but only the dial-plan editor needs it. Install it if you import ./dial-plan:

npm install @xyflow/react

It holds module-level state that must not be duplicated, which is why it resolves to the one copy your app installs rather than a copy of ours.

You do not need to import any stylesheet. Components render into shadow roots and carry the styles they need.

One import path per component

Components are not exported from the package root. Each has its own subpath:

import { DialstackComponentsProvider } from '@dialstack/sdk-react';
import { CallLogs } from '@dialstack/sdk-react/call-logs';
import { Voicemails } from '@dialstack/sdk-react/voicemails';

<DialstackComponentsProvider dialstack={dialstack}>
  <CallLogs />
  <Voicemails userId={userId} />
</DialstackComponentsProvider>;
SubpathExports
@dialstack/sdk-reactDialstackComponentsProvider, useDialstack, useDialstackComponents, useCreateComponent, useAppearance, useUpdateWithSetter
./call-logsCallLogs
./voicemailsVoicemails
./call-historyCallHistory
./phone-numbersPhoneNumbers
./phone-number-orderingPhoneNumberOrdering
./ai-agentAIAgent, the FAQ prefill helpers
./dial-planDialPlan and its types
./softphoneSoftphoneProvider, Softphone, the call hooks and UI primitives
./onboardingOnboardingPortal

Why not a root barrel. A barrel re-exporting every component makes the whole module graph behind it reachable from any single import, so importing one thin wrapper pulled in the dial-plan editor's @xyflow/react, dagre and cmdk regardless. Measured: ~144 KB with all three, against ~58 KB for the softphone alone and ~1.5 KB for an element wrapper when imported directly. sideEffects: false cannot fix that — the code is genuinely reachable, not dead — and neither does emitting per-module files. Splitting the entry point is the only thing that works.

Every subpath resolves the same React context, so a provider your app renders is visible to whatever it wraps.

The softphone needs no initializer

It is the one component family that authenticates on its own — a short-lived user-session token over a WebSocket, rather than the instance's client secret over REST:

import { SoftphoneProvider, Softphone } from '@dialstack/sdk-react/softphone';

<SoftphoneProvider token={userSessionToken}>
  <Softphone />
</SoftphoneProvider>;

No loadDialstackAndInitialize, no <DialstackComponentsProvider>. Passing an instance is optional and only enables live appearance sync. Registration, dialling and in-call control keep working when the REST API is unreachable, which is deliberate.

Everything else needs one

The remaining components read the REST API, so they need an initialized instance above them — including DialPlan, which renders its own canvas rather than a web component but is the heaviest consumer of the instance in the package.

If a component renders blank, that is what to check first. This package throws a named error when the elements were never registered, which happens if @dialstack/sdk-js is missing or your bundler dropped its side-effect imports.

Documentation

Full documentation: https://docs.dialstack.ai/sdks

License

MIT

版本与发布记录

@dialstack/sdk-react 共发布 12 个版本,首次发布于 2026/08/10;过去 12 个月发布了 12 个版本。

版本发布日期距今
3.10.0latest2026/11/102 天前
3.9.02026/11/029 天前
3.8.02026/10/2616 天前
3.7.02026/10/1923 天前
3.6.02026/10/1230 天前
3.5.02026/10/051 个月前

其他发布通道:bootstrap → 2.1.0。

关于 @dialstack/sdk-react 的常见问题

@dialstack/sdk-react 是什么?

React components and hooks for the DialStack SDK — call logs, voicemails, dial plan, softphone and onboarding

如何安装 @dialstack/sdk-react?

在项目目录运行 npm install @dialstack/sdk-react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18 || ^19)、react-dom(^18 || ^19)、@xyflow/react(^12.0.0)、@dialstack/sdk-js(>=3.10.0 <4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dialstack/sdk-react 支持 TypeScript 吗?

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

@dialstack/sdk-react 支持 ESM 还是 CommonJS?

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

@dialstack/sdk-react 需要什么版本的 Node.js?

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

@dialstack/sdk-react 可以商用吗?

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

@dialstack/sdk-react 的下载量有多少?

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

@dialstack/sdk-react 还在维护吗?

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